Unverified Commit a809a15e authored by alexpott's avatar alexpott

Issue #2945563 by maxocub, heddn: Migration dependencies are not set when...

Issue #2945563 by maxocub, heddn: Migration dependencies are not set when using the migration_lookup or iterator process plugins
parent 66480d7f
......@@ -620,19 +620,22 @@ public function getMigrationDependencies() {
}
/**
* 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 @@ public function testGetMigrationDependencies() {
],
],
],
'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());
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment