You are here

protected function ProductAttributeValue::rowUnique in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 modules/magento/src/Plugin/migrate/source/magento2/ProductAttributeValue.php \Drupal\commerce_migrate_magento\Plugin\migrate\source\magento2\ProductAttributeValue::rowUnique()
  2. 3.0.x modules/magento/src/Plugin/migrate/source/magento2/ProductAttributeValue.php \Drupal\commerce_migrate_magento\Plugin\migrate\source\magento2\ProductAttributeValue::rowUnique()

Tests if the row is unique.

Parameters

array $row: An array of attribute_name and attribute_value for the current row.

Return value

bool Return TRUE if the row is unique, FALSE if it is not unique.

1 call to ProductAttributeValue::rowUnique()
ProductAttributeValue::getYield in modules/magento/src/Plugin/migrate/source/magento2/ProductAttributeValue.php
Prepare one row per attribute and option.

File

modules/magento/src/Plugin/migrate/source/magento2/ProductAttributeValue.php, line 78

Class

ProductAttributeValue
Yields each product attribute and one option..

Namespace

Drupal\commerce_migrate_magento\Plugin\migrate\source\magento2

Code

protected function rowUnique(array $row) {
  static $unique_rows = [];
  foreach ($unique_rows as $unique) {
    if ($unique['attribute'] === $row['attribute'] && $unique['name'] === $row['name']) {
      return FALSE;
    }
  }
  $unique_rows[] = $row;
  return TRUE;
}