You are here

protected function MigrateUpgradeDrushRunner::substituteMigrationIds in Migrate Upgrade 8.2

Same name and namespace in other branches
  1. 8.3 src/MigrateUpgradeDrushRunner.php \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner::substituteMigrationIds()

Recursively substitute IDs for migration plugins.

Parameters

mixed $process:

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 228

Class

MigrateUpgradeDrushRunner

Namespace

Drupal\migrate_upgrade

Code

protected function substituteMigrationIds(&$process) {
  if (is_array($process)) {

    // We found a migration plugin, change the ID.
    if (isset($process['plugin']) && $process['plugin'] == 'migration') {
      if (is_array($process['migration'])) {
        $new_migration = [];
        foreach ($process['migration'] as $migration) {
          $new_migration[] = $this
            ->modifyId($migration);
        }
        $process['migration'] = $new_migration;
      }
      else {
        $process['migration'] = $this
          ->modifyId($process['migration']);
      }
    }
    else {

      // Recurse on each array member.
      foreach ($process as &$subprocess) {
        $this
          ->substituteMigrationIds($subprocess);
      }
    }
  }
}