You are here

protected function TaxonomyTerm::rowUnique in Commerce Migrate 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/csv_example/src/Plugin/migrate/source/TaxonomyTerm.php \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\TaxonomyTerm::rowUnique()
  2. 3.1.x modules/csv_example/src/Plugin/migrate/source/TaxonomyTerm.php \Drupal\commerce_migrate_csv_example\Plugin\migrate\source\TaxonomyTerm::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 TaxonomyTerm::rowUnique()
TaxonomyTerm::getYield in modules/csv_example/src/Plugin/migrate/source/TaxonomyTerm.php
Prepare one row per taxonomy term field in the source.

File

modules/csv_example/src/Plugin/migrate/source/TaxonomyTerm.php, line 65

Class

TaxonomyTerm
Yields each taxonomy vocabulary and term pair.

Namespace

Drupal\commerce_migrate_csv_example\Plugin\migrate\source

Code

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