You are here

public function MigrationController::run in Migrate Tools 8.5

Same name and namespace in other branches
  1. 8.4 src/Controller/MigrationController.php \Drupal\migrate_tools\Controller\MigrationController::run()

Run a migration.

Parameters

\Drupal\migrate_plus\Entity\MigrationGroupInterface $migration_group: The migration group.

\Drupal\migrate_plus\Entity\MigrationInterface $migration: The $migration.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse|null A redirect response if the batch is progressive. Else no return value.

1 string reference to 'MigrationController::run'
migrate_tools.routing.yml in ./migrate_tools.routing.yml
migrate_tools.routing.yml

File

src/Controller/MigrationController.php, line 167

Class

MigrationController
Returns responses for migrate_tools migration view routes.

Namespace

Drupal\migrate_tools\Controller

Code

public function run(MigrationGroupInterface $migration_group, MigrationInterface $migration) {
  $migrateMessage = new MigrateMessage();
  $options = [];
  $migration_plugin = $this->migrationPluginManager
    ->createInstance($migration
    ->id(), $migration
    ->toArray());
  $executable = new MigrateBatchExecutable($migration_plugin, $migrateMessage, $options);
  $executable
    ->batchImport();
  $route_parameters = [
    'migration_group' => $migration_group,
    'migration' => $migration
      ->id(),
  ];
  return batch_process(Url::fromRoute('entity.migration.process', $route_parameters));
}