function MigrationPluginManager::createInstances

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

Overrides MigrationPluginManagerInterface::createInstances

2 calls to MigrationPluginManager::createInstances()
MigrationPluginManager::createInstance in core/modules/migrate/src/Plugin/MigrationPluginManager.php
MigrationPluginManager::createInstancesByTag in core/modules/migrate/src/Plugin/MigrationPluginManager.php
Create migrations given a tag.

File

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

Class

MigrationPluginManager
Plugin manager for migration plugins.

Namespace

Drupal\migrate\Plugin

Code

public function createInstances($migration_id, array $configuration = []) {
    if (empty($migration_id)) {
        $migration_id = array_keys($this->getDefinitions());
    }
    $factory = $this->getFactory();
    $migration_ids = (array) $migration_id;
    $plugin_ids = $this->expandPluginIds($migration_ids);
    $instances = [];
    foreach ($plugin_ids as $plugin_id) {
        $instances[$plugin_id] = $factory->createInstance($plugin_id, $configuration[$plugin_id] ?? []);
    }
    foreach ($instances as $migration) {
        $migration->set('migration_dependencies', array_map([
            $this,
            'expandPluginIds',
        ], $migration->getMigrationDependencies()));
    }
    // Sort the migrations based on their dependencies.
    return $this->buildDependencyMigration($instances, []);
}

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