public function Category::getYield in Commerce Migrate 8.2
Same name and namespace in other branches
- 3.1.x modules/magento/src/Plugin/migrate/source/magento2/Category.php \Drupal\commerce_migrate_magento\Plugin\migrate\source\magento2\Category::getYield()
- 3.0.x modules/magento/src/Plugin/migrate/source/magento2/Category.php \Drupal\commerce_migrate_magento\Plugin\migrate\source\magento2\Category::getYield()
Prepare one row per taxonomy vocabulary in the source data.
@codingStandardsIgnoreStart
@codingStandardsIgnoreEnd
Parameters
\Generator $file: The source CSV file object.
Return value
\Generator A new row, one for each unique vocabulary.
1 call to Category::getYield()
- Category::initializeIterator in modules/
magento/ src/ Plugin/ migrate/ source/ magento2/ Category.php
File
- modules/
magento/ src/ Plugin/ migrate/ source/ magento2/ Category.php, line 51
Class
- Category
- Yields each taxonomy vocabulary.
Namespace
Drupal\commerce_migrate_magento\Plugin\migrate\source\magento2Code
public function getYield(\Generator $file) {
foreach ($file as $row) {
$new_row = [];
$categoryGroup = explode(',', $row['categories']);
foreach ($categoryGroup as $category) {
$new_row['vocabulary'] = strstr($category, '/', TRUE);
if ($this
->rowUnique($new_row)) {
(yield $new_row);
}
}
}
}