You are here

protected function ParagraphsMigrationTestBase::executeMigrationDependencies in Paragraphs 8

Find and execute a migration's dependencies.

Parameters

\Drupal\migrate\Plugin\MigrationInterface $migration: The Migration from which to execute dependencies.

1 call to ParagraphsMigrationTestBase::executeMigrationDependencies()
ParagraphsMigrationTestBase::executeMigrationWithDependencies in tests/src/Kernel/migrate/ParagraphsMigrationTestBase.php
Execute a migration's dependencies followed by the migration.

File

tests/src/Kernel/migrate/ParagraphsMigrationTestBase.php, line 109

Class

ParagraphsMigrationTestBase
Base class for the paragraph migrations tests.

Namespace

Drupal\Tests\paragraphs\Kernel\migrate

Code

protected function executeMigrationDependencies(MigrationInterface $migration) {
  $dependencies = $migration
    ->getMigrationDependencies();
  foreach ($dependencies['required'] as $dependency) {
    $plugin = $this
      ->getMigration($dependency);
    if (!$plugin
      ->allRowsProcessed()) {
      $this
        ->executeMigrationDependencies($plugin);
      $this
        ->executeMigration($plugin);
    }
  }
  foreach ($dependencies['optional'] as $dependency) {
    if ($plugin = $this
      ->getMigration($dependency)) {
      if (!$plugin
        ->allRowsProcessed()) {
        $this
          ->executeMigrationDependencies($plugin);
        $this
          ->executeMigration($plugin);
      }
    }
  }
}