You are here

public function MigrationDefinitionCreator::createMigrationDefinition in GatherContent 8.5

Create migration definitions.

File

src/MigrationDefinitionCreator.php, line 221

Class

MigrationDefinitionCreator
Create dynamic migration definitions.

Namespace

Drupal\gathercontent

Code

public function createMigrationDefinition() {
  $definitions = $this
    ->getGroupedDefinitions();
  if (!$definitions) {
    return;
  }
  $this
    ->setLanguageDefinitions($definitions);
  $this
    ->setReferenceDependencies($definitions);
  foreach ($definitions as $definition) {
    $migration = Migration::create($definition);
    $migration
      ->save();
    $this->migrationDefinitionIds[] = $definition['id'];
  }
  $this->mapping
    ->set('migration_definitions', $this->migrationDefinitionIds);
  $this->mapping
    ->save();
}