protected function MigrateUpgradeDrushRunner::substituteMigrationIds in Migrate Upgrade 8.3
Same name and namespace in other branches
- 8.2 src/MigrateUpgradeDrushRunner.php \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner::substituteMigrationIds()
Recursively substitute IDs for migration plugins.
Parameters
array|string $process: The process to inspect and substitute.
1 call to MigrateUpgradeDrushRunner::substituteMigrationIds()
- MigrateUpgradeDrushRunner::substituteIds in src/
MigrateUpgradeDrushRunner.php - Rewrite any migration plugin IDs so they won't conflict with the core IDs.
File
- src/
MigrateUpgradeDrushRunner.php, line 374
Class
- MigrateUpgradeDrushRunner
- Class MigrateUpgradeDrushRunner.
Namespace
Drupal\migrate_upgradeCode
protected function substituteMigrationIds(&$process) {
if (is_array($process)) {
// We found a migration plugin, change the ID.
if (isset($process['plugin']) && in_array($process['plugin'], $this->migrationLookupPluginIds)) {
if (is_array($process['migration'])) {
$migration_ids = $process['migration'];
}
else {
$migration_ids = [
$process['migration'],
];
}
$expanded_migration_ids = $this
->expandPluginIds($migration_ids);
$new_migration_ids = array_map([
$this,
'modifyId',
], $expanded_migration_ids);
if (count($new_migration_ids) == 1) {
$process['migration'] = reset($new_migration_ids);
}
else {
$process['migration'] = $new_migration_ids;
}
// The source_ids configuration for migrate_lookup is keyed by
// migration id. If it is there, we need to rekey to the new ids.
if (isset($process['source_ids']) && is_array($process['source_ids'])) {
$new_source_ids = [];
foreach ($process['source_ids'] as $migration_id => $source_ids) {
$new_migration_id = $this
->modifyId($migration_id);
$new_source_ids[$new_migration_id] = $source_ids;
}
$process['source_ids'] = $new_source_ids;
}
}
else {
// Recurse on each array member.
foreach ($process as &$subprocess) {
$this
->substituteMigrationIds($subprocess);
}
}
}
}