Issue #2945563 by maxocub, heddn: Migration dependencies are not set when using the migration_lookup or iterator process plugins
parent
66480d7f40
commit
a809a15ece
|
@ -620,19 +620,22 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn
|
|||
}
|
||||
|
||||
/**
|
||||
* Find migration dependencies from the migration and the iterator plugins.
|
||||
* Find migration dependencies from migration_lookup and sub_process plugins.
|
||||
*
|
||||
* @param array $process
|
||||
* A process configuration array.
|
||||
*
|
||||
* @param $process
|
||||
* @return array
|
||||
* The migration dependencies.
|
||||
*/
|
||||
protected function findMigrationDependencies($process) {
|
||||
$return = [];
|
||||
foreach ($this->getProcessNormalized($process) as $process_pipeline) {
|
||||
foreach ($process_pipeline as $plugin_configuration) {
|
||||
if ($plugin_configuration['plugin'] == 'migration') {
|
||||
if (in_array($plugin_configuration['plugin'], ['migration', 'migration_lookup'], TRUE)) {
|
||||
$return = array_merge($return, (array) $plugin_configuration['migration']);
|
||||
}
|
||||
if ($plugin_configuration['plugin'] == 'sub_process') {
|
||||
if (in_array($plugin_configuration['plugin'], ['iterator', 'sub_process'], TRUE)) {
|
||||
$return = array_merge($return, $this->findMigrationDependencies($plugin_configuration['process']));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,10 +50,32 @@ class MigrationTest extends KernelTestBase {
|
|||
],
|
||||
],
|
||||
],
|
||||
'f4' => [
|
||||
'plugin' => 'migration_lookup',
|
||||
'migration' => 'm3'
|
||||
],
|
||||
'f5' => [
|
||||
'plugin' => 'sub_process',
|
||||
'process' => [
|
||||
'target_id' => [
|
||||
'plugin' => 'migration_lookup',
|
||||
'migration' => 'm4',
|
||||
],
|
||||
],
|
||||
],
|
||||
'f6' => [
|
||||
'plugin' => 'iterator',
|
||||
'process' => [
|
||||
'target_id' => [
|
||||
'plugin' => 'migration_lookup',
|
||||
'migration' => 'm5',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
$migration = $plugin_manager->createStubMigration($plugin_definition);
|
||||
$this->assertSame(['required' => [], 'optional' => ['m1', 'm2']], $migration->getMigrationDependencies());
|
||||
$this->assertSame(['required' => [], 'optional' => ['m1', 'm2', 'm3', 'm4', 'm5']], $migration->getMigrationDependencies());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue