public function CsvCell::getYield in Commerce Migrate 8.2
Same name and namespace in other branches
- 3.1.x src/Plugin/migrate/source/csv/CsvCell.php \Drupal\commerce_migrate\Plugin\migrate\source\csv\CsvCell::getYield()
- 3.0.x src/Plugin/migrate/source/csv/CsvCell.php \Drupal\commerce_migrate\Plugin\migrate\source\csv\CsvCell::getYield()
Prepare one row per taxonomy term field in the source.
@codingStandardsIgnoreStart
@codingStandardsIgnoreEnd
Parameters
\Generator $file: The source CSV file object.
Return value
\Generator A new row with one taxonomy term.
1 call to CsvCell::getYield()
- CsvCell::initializeIterator in src/
Plugin/ migrate/ source/ csv/ CsvCell.php
File
- src/
Plugin/ migrate/ source/ csv/ CsvCell.php, line 41
Class
- CsvCell
- Yields source values from a cell that is a comma separated list.
Namespace
Drupal\commerce_migrate\Plugin\migrate\source\csvCode
public function getYield(\Generator $file) {
$key = reset($this->configuration['ids']);
foreach ($file as $row) {
$new_row = [];
$tags = explode(',', $row['Tags']);
foreach ($tags as $tag) {
$new_row[$key] = trim($tag);
(yield $new_row);
}
}
}