You are here

public function YieldRows::getYield in Migrate Source CSV 8.2

Prepare a test row using yield.

@codingStandardsIgnoreStart

@codingStandardsIgnoreEnd

Parameters

\SplFileObject $file: The source CSV file object.

Return value

\Generator A new row with only the id value.

1 call to YieldRows::getYield()
YieldRows::initializeIterator in tests/modules/source_plugin_yield_test/src/Plugin/migrate/source/YieldRows.php
Initializes the iterator with the source data.

File

tests/modules/source_plugin_yield_test/src/Plugin/migrate/source/YieldRows.php, line 37

Class

YieldRows
Yields each image and sku.

Namespace

Drupal\source_plugin_yield_test\Plugin\migrate\source

Code

public function getYield(\SplFileObject $file) {
  foreach ($file as $row_num => $row) {
    $new_row = [];
    $new_row['id'] = $row['id'];
    (yield $new_row);
  }
}