function Migration::checkRequirements

Same name in other branches
  1. 8.9.x core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::checkRequirements()
  2. 10 core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::checkRequirements()
  3. 11.x core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::checkRequirements()

Overrides RequirementsInterface::checkRequirements

1 call to Migration::checkRequirements()
ProfileValues::getProcess in core/modules/user/src/Plugin/migrate/ProfileValues.php
Gets the normalized process plugin configuration.

File

core/modules/migrate/src/Plugin/Migration.php, line 507

Class

Migration
Defines the Migration plugin.

Namespace

Drupal\migrate\Plugin

Code

public function checkRequirements() {
    // Check whether the current migration source and destination plugin
    // requirements are met or not.
    if ($this->getSourcePlugin() instanceof RequirementsInterface) {
        $this->getSourcePlugin()
            ->checkRequirements();
    }
    if ($this->getDestinationPlugin() instanceof RequirementsInterface) {
        $this->getDestinationPlugin()
            ->checkRequirements();
    }
    if (empty($this->requirements)) {
        // There are no requirements to check.
        return;
    }
    
    /** @var \Drupal\migrate\Plugin\MigrationInterface[] $required_migrations */
    $required_migrations = $this->getMigrationPluginManager()
        ->createInstances($this->requirements);
    $missing_migrations = array_diff($this->requirements, array_keys($required_migrations));
    // Check if the dependencies are in good shape.
    foreach ($required_migrations as $migration_id => $required_migration) {
        if (!$required_migration->allRowsProcessed()) {
            $missing_migrations[] = $migration_id;
        }
    }
    if ($missing_migrations) {
        throw new RequirementsException('Missing migrations ' . implode(', ', $missing_migrations) . '.', [
            'requirements' => $missing_migrations,
        ]);
    }
}

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