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