You are here

public function MigrateUpgradeDrushRunner::import in Migrate Upgrade 8

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

Run the configured migrations.

File

src/MigrateUpgradeDrushRunner.php, line 54
Contains \Drupal\migrate_upgrade\MigrateUpgradeDrushRunner.

Class

MigrateUpgradeDrushRunner

Namespace

Drupal\migrate_upgrade

Code

public function import() {
  static::$messages = new DrushLogMigrateMessage();
  if (drush_get_option('debug')) {
    \Drupal::service('event_dispatcher')
      ->addListener(MigrateEvents::IDMAP_MESSAGE, [
      get_class(),
      'onIdMapMessage',
    ]);
  }
  foreach ($this->migrationList as $migration_id) {

    /** @var MigrationInterface $migration */
    $migration = Migration::load($migration_id);
    drush_print(dt('Upgrading @migration', [
      '@migration' => $migration_id,
    ]));
    $executable = new MigrateExecutable($migration, static::$messages);

    // drush_op() provides --simulate support.
    drush_op([
      $executable,
      'import',
    ]);
  }
}