function MigrationPluginManager::addDependency

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

Add one or more dependencies to a graph.

Parameters

array $graph: The graph so far, passed by reference.

int $id: The migration ID.

string $dependency: The dependency string.

array $dynamic_ids: The dynamic ID mapping.

1 call to MigrationPluginManager::addDependency()
MigrationPluginManager::buildDependencyMigration in core/modules/migrate/src/Plugin/MigrationPluginManager.php
Builds a dependency tree for the migrations and set their order.

File

core/modules/migrate/src/Plugin/MigrationPluginManager.php, line 235

Class

MigrationPluginManager
Plugin manager for migration plugins.

Namespace

Drupal\migrate\Plugin

Code

protected function addDependency(array &$graph, $id, $dependency, $dynamic_ids) {
    $dependencies = isset($dynamic_ids[$dependency]) ? $dynamic_ids[$dependency] : [
        $dependency,
    ];
    if (!isset($graph[$id]['edges'])) {
        $graph[$id]['edges'] = [];
    }
    $graph[$id]['edges'] += array_combine($dependencies, $dependencies);
}

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