Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Migration.php

function 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 476

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,
        ]);
    }
}
RSS feed
Powered by Drupal