You are here

protected function MigrationCreationTrait::createMigrations in Migrate Upgrade 8

Saves the migrations for import from the provided template connection.

Parameters

array $migration_templates: Migration template.

Return value

array The migration IDs sorted in dependency order.

2 calls to MigrationCreationTrait::createMigrations()
MigrateUpgradeDrushRunner::configure in src/MigrateUpgradeDrushRunner.php
From the provided source information, instantiate the appropriate migrations in the active configuration.
MigrateUpgradeForm::submitConfirmForm in src/Form/MigrateUpgradeForm.php
Submission handler for the confirmation form.

File

src/MigrationCreationTrait.php, line 160
Contains \Drupal\migrate_upgrade\MigrationCreationTrait.

Class

MigrationCreationTrait
Creates the appropriate migrations for a given source Drupal database.

Namespace

Drupal\migrate_upgrade

Code

protected function createMigrations(array $migration_templates) {
  $migration_ids = [];
  $migrations = $this
    ->getMigrations($migration_templates);
  foreach ($migrations as $migration) {

    // Don't try to resave migrations that already exist.
    if (!Migration::load($migration
      ->id())) {
      $migration
        ->save();
    }
    $migration_ids[] = $migration
      ->id();
  }

  // loadMultiple will sort the migrations in dependency order.
  return array_keys(Migration::loadMultiple($migration_ids));
}