public function Migration::checkRequirements in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/src/Entity/Migration.php \Drupal\migrate\Entity\Migration::checkRequirements()
Checks if requirements for this plugin are OK.
Throws
\Drupal\migrate\Exception\RequirementsException Thrown when requirements are not met.
Overrides RequirementsInterface::checkRequirements
File
- core/
modules/ migrate/ src/ Entity/ Migration.php, line 374 - Contains \Drupal\migrate\Entity\Migration.
Class
- Migration
- Defines the Migration entity.
Namespace
Drupal\migrate\EntityCode
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();
}
/** @var \Drupal\migrate\Entity\MigrationInterface[] $required_migrations */
$required_migrations = $this
->getEntityManager()
->getStorage('migration')
->loadMultiple($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,
]);
}
}