function Migration::findMigrationDependencies

Same name and namespace in other branches
  1. 9 core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::findMigrationDependencies()
  2. 8.9.x core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::findMigrationDependencies()
  3. 10 core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::findMigrationDependencies()

Find migration dependencies from migration_lookup and sub_process plugins.

Parameters

array $process: A process configuration array.

Return value

array The migration dependencies.

1 call to Migration::findMigrationDependencies()
Migration::getMigrationDependencies in core/modules/migrate/src/Plugin/Migration.php
Get the dependencies for this migration.

File

core/modules/migrate/src/Plugin/Migration.php, line 673

Class

Migration
Defines the Migration plugin.

Namespace

Drupal\migrate\Plugin

Code

protected function findMigrationDependencies($process) {
    $return = [];
    foreach ($this->getProcessNormalized($process) as $process_pipeline) {
        foreach ($process_pipeline as $plugin_configuration) {
            // If the migration uses a deriver and has a migration_lookup with
            // itself as the source migration, then skip adding dependencies.
            // Otherwise the migration will depend on all the variations of itself.
            // See d7_taxonomy_term for an example.
            if (isset($this->deriver) && $plugin_configuration['plugin'] === 'migration_lookup' && $plugin_configuration['migration'] == $this->getBaseId()) {
                continue;
            }
            if (in_array($plugin_configuration['plugin'], [
                'migration',
                'migration_lookup',
            ], TRUE)) {
                $return = array_merge($return, (array) $plugin_configuration['migration']);
            }
            if (in_array($plugin_configuration['plugin'], [
                'iterator',
                'sub_process',
            ], TRUE)) {
                $return = array_merge($return, $this->findMigrationDependencies($plugin_configuration['process']));
            }
        }
    }
    return $return;
}

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