function MigrateLookup::lookup

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

File

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

Class

MigrateLookup
Provides a migration lookup service.

Namespace

Drupal\migrate

Code

public function lookup($migration_id, array $source_id_values) {
    $results = [];
    $migrations = $this->migrationPluginManager
        ->createInstances($migration_id);
    if (!$migrations) {
        if (is_array($migration_id)) {
            if (count($migration_id) != 1) {
                throw new PluginException("Plugin IDs '" . implode("', '", $migration_id) . "' were not found.");
            }
            $migration_id = reset($migration_id);
        }
        throw new PluginNotFoundException($migration_id);
    }
    foreach ($migrations as $migration) {
        if ($result = $this->doLookup($migration, $source_id_values)) {
            $results = array_merge($results, $result);
        }
    }
    return $results;
}

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