function MigrateLookup::doLookup

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/MigrateLookup.php \Drupal\migrate\MigrateLookup::doLookup()
  2. 10 core/modules/migrate/src/MigrateLookup.php \Drupal\migrate\MigrateLookup::doLookup()
  3. 11.x core/modules/migrate/src/MigrateLookup.php \Drupal\migrate\MigrateLookup::doLookup()

Performs a lookup.

Parameters

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration upon which to perform the lookup.

array $source_id_values: The source ID values to look up.

Return value

array An array of arrays of destination identifier values.

Throws

\Drupal\migrate\MigrateException Thrown when $source_id_values contains unknown keys, or the wrong number of keys.

1 call to MigrateLookup::doLookup()
MigrateLookup::lookup in core/modules/migrate/src/MigrateLookup.php
Retrieves destination ids from a migration lookup.

File

core/modules/migrate/src/MigrateLookup.php, line 63

Class

MigrateLookup
Provides a migration lookup service.

Namespace

Drupal\migrate

Code

protected function doLookup(MigrationInterface $migration, array $source_id_values) {
    $destination_keys = array_keys($migration->getDestinationPlugin()
        ->getIds());
    $indexed_ids = $migration->getIdMap()
        ->lookupDestinationIds($source_id_values);
    $keyed_ids = [];
    foreach ($indexed_ids as $id) {
        $keyed_ids[] = array_combine($destination_keys, $id);
    }
    return $keyed_ids;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.