public function TaxonomyTerm::getYield in Commerce Migrate 8.2
Same name and namespace in other branches
- 3.1.x modules/csv_example/src/Plugin/migrate/source/TaxonomyTerm.php \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\TaxonomyTerm::getYield()
- 3.0.x modules/csv_example/src/Plugin/migrate/source/TaxonomyTerm.php \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\TaxonomyTerm::getYield()
Prepare one row per taxonomy term field in the source.
@codingStandardsIgnoreStart
@codingStandardsIgnoreEnd
Parameters
\Generator $file: The source data.
Return value
\Generator A new row, one for each filename in the source image column.
1 call to TaxonomyTerm::getYield()
- TaxonomyTerm::initializeIterator in modules/
csv_example/ src/ Plugin/ migrate/ source/ TaxonomyTerm.php
File
- modules/
csv_example/ src/ Plugin/ migrate/ source/ TaxonomyTerm.php, line 41
Class
- TaxonomyTerm
- Yields each taxonomy vocabulary and term pair.
Namespace
Drupal\commerce_migrate_csv_example\Plugin\migrate\sourceCode
public function getYield(\Generator $file) {
foreach ($file as $row) {
$new_row = [];
for ($i = 1; $i < 4; $i++) {
$new_row['vocabulary_name'] = trim($row["vocabulary_name{$i}"]);
$new_row['term'] = trim($row["term{$i}"]);
if (!empty($new_row['vocabulary_name']) && !empty($new_row['term'])) {
if ($this
->rowUnique($new_row)) {
(yield $new_row);
}
}
}
}
}