[migrate:*] Updated commands to process migrations #2493
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
List of changes:
Now we are using plugins to get a list of migrations ids
I removed the method getMigrations() from src/Command/ContainerAwareCommand.php and I moved it to a new Trait called MigrationTraid.
We load migrations using this:
$plugin_manager = $this->getDrupalService('plugin.manager.migration'); $all_migrations = $plugin_manager->createInstancesByTag($version_tag);
To get those migrations we must to set up the database settings, so I made some changes to command migrate:setup
This command now only load the database configuration , so I removed the code which generate templates.
In order to get the dbTypes now we are calling the function directly from the core with:
include_once DRUPAL_ROOT . '/core/includes/install.inc'; return drupal_get_database_types();
To execute a migration , we create instances using the plugins
$migration_service = $this->getDrupalService('plugin.manager.migration'); $migration_service = $migration_service->createInstance($migration_id);
Note: To get a list of migrations , just run drupal migrate:debug and you are going to a get the full list , so if you want filter that list , try with drupal migrate:debug 7 or drupal migrate:debug 6