function _drush_migrate_tools_execute_migration in Migrate Tools 8
Same name and namespace in other branches
- 8.2 migrate_tools.drush.inc \_drush_migrate_tools_execute_migration()
- 8.3 migrate_tools.drush.inc \_drush_migrate_tools_execute_migration()
- 8.4 migrate_tools.drush.inc \_drush_migrate_tools_execute_migration()
Executes a single migration. If the --execute-dependencies option was given, the migration's dependencies will also be executed first.
Parameters
\Drupal\migrate\Entity\MigrationInterface $migration: The migration to execute.
string $migration_id: The migration ID (not used, just an artifact of array_walk()).
array $options: Additional options for the migration.
1 string reference to '_drush_migrate_tools_execute_migration'
File
- ./
migrate_tools.drush.inc, line 246 - Command-line tools to aid performing and developing migrations.
Code
function _drush_migrate_tools_execute_migration(MigrationInterface $migration, $migration_id, array $options = []) {
$log = new DrushLogMigrateMessage();
if (drush_get_option('execute-dependencies')) {
$required_migrations = \Drupal::entityTypeManager()
->getStorage('migration')
->loadMultiple($migration
->get('requirements'));
$dependency_options = array_merge($options, [
'is_dependency' => TRUE,
]);
array_walk($required_migrations, __FUNCTION__, $dependency_options);
}
if ($options['force']) {
$migration
->set('requirements', []);
}
if ($options['update']) {
$migration
->getIdMap()
->prepareUpdate();
}
$executable = new MigrateExecutable($migration, $log, $options);
// drush_op() provides --simulate support
drush_op(array(
$executable,
'import',
));
}