function MigrationPluginManager::createInstances
Same name in other branches
- 9 core/modules/migrate/src/Plugin/MigrationPluginManager.php \Drupal\migrate\Plugin\MigrationPluginManager::createInstances()
- 8.9.x core/modules/migrate/src/Plugin/MigrationPluginManager.php \Drupal\migrate\Plugin\MigrationPluginManager::createInstances()
- 11.x core/modules/migrate/src/Plugin/MigrationPluginManager.php \Drupal\migrate\Plugin\MigrationPluginManager::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
File
-
core/
modules/ migrate/ src/ Plugin/ MigrationPluginManager.php, line 100
Class
- MigrationPluginManager
- Plugin manager for migration plugins.
Namespace
Drupal\migrate\PluginCode
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;
// We need to expand any derivative migrations. Derivative migrations are
// calculated by migration derivers such as D6NodeDeriver. This allows
// migrations to depend on the base id and then have a dependency on all
// derivative migrations. For example, d6_comment depends on d6_node but
// after we've expanded the dependencies it will depend on d6_node:page,
// d6_node:story and so on, for other derivative migrations.
$plugin_ids = $this->expandPluginIds($migration_ids);
$instances = [];
foreach ($plugin_ids as $plugin_id) {
$instances[$plugin_id] = $factory->createInstance($plugin_id, $configuration[$plugin_id] ?? []);
}
// @todo Remove loop when the ability to call ::getMigrationDependencies()
// without expanding plugins is removed.
foreach ($instances as $migration) {
$migration->set('migration_dependencies', $migration->getMigrationDependencies(TRUE));
}
// 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.