function ReferenceBase::alterFieldInstanceMigration

Same name in other branches
  1. 9 core/modules/migrate_drupal/src/Plugin/migrate/field/ReferenceBase.php \Drupal\migrate_drupal\Plugin\migrate\field\ReferenceBase::alterFieldInstanceMigration()
  2. 10 core/modules/migrate_drupal/src/Plugin/migrate/field/ReferenceBase.php \Drupal\migrate_drupal\Plugin\migrate\field\ReferenceBase::alterFieldInstanceMigration()

Overrides FieldPluginBase::alterFieldInstanceMigration

File

core/modules/migrate_drupal/src/Plugin/migrate/field/ReferenceBase.php, line 33

Class

ReferenceBase
Base class for Drupal reference fields.

Namespace

Drupal\migrate_drupal\Plugin\migrate\field

Code

public function alterFieldInstanceMigration(MigrationInterface $migration) {
    parent::alterFieldInstanceMigration($migration);
    // Add the reference migration as a required dependency to this migration.
    $migration_dependencies = $migration->getMigrationDependencies();
    array_push($migration_dependencies['required'], $this->getEntityTypeMigrationId());
    $migration_dependencies['required'] = array_unique($migration_dependencies['required']);
    $migration->set('migration_dependencies', $migration_dependencies);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.