You are here

public function MigrateUpgradeDrushRunner::import in Migrate Upgrade 8.3

Same name and namespace in other branches
  1. 8 src/MigrateUpgradeDrushRunner.php \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner::import()
  2. 8.2 src/MigrateUpgradeDrushRunner.php \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner::import()

Run the configured migrations.

Return value

array The executed migration names.

File

src/MigrateUpgradeDrushRunner.php, line 224

Class

MigrateUpgradeDrushRunner
Class MigrateUpgradeDrushRunner.

Namespace

Drupal\migrate_upgrade

Code

public function import() {
  $migration_ids = [];
  static::$messages = new DrushLogMigrateMessage($this->logger);
  if ($this->options['debug']) {
    \Drupal::service('event_dispatcher')
      ->addListener(MigrateEvents::IDMAP_MESSAGE, [
      get_class(),
      'onIdMapMessage',
    ]);
  }
  foreach ($this->migrationList as $migration_id => $migration) {
    $this->logger
      ->log('ok', dt('Upgrading @migration', [
      '@migration' => $migration_id,
    ]));
    $executable = new MigrateExecutable($migration, static::$messages);

    // drush_op() provides --simulate support.
    drush_op([
      $executable,
      'import',
    ]);
    $migration_ids[$migration_id] = [
      'original' => $migration_id,
      'generated' => $migration_id,
    ];
  }
  return $migration_ids;
}