Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
97642595
Commit
97642595
authored
Sep 2, 2016
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2750639
by chx, mikeryan: Gather some migration dependencies automatically
parent
35778ab2
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/migrate/src/Plugin/Migration.php
+24
-1
24 additions, 1 deletion
core/modules/migrate/src/Plugin/Migration.php
core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php
+21
-4
21 additions, 4 deletions
...modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php
with
45 additions
and
5 deletions
core/modules/migrate/src/Plugin/Migration.php
+
24
−
1
View file @
97642595
...
...
@@ -669,7 +669,30 @@ public function setTrackLastImported($track_last_imported) {
* {@inheritdoc}
*/
public
function
getMigrationDependencies
()
{
return
(
$this
->
migration_dependencies
?:
[])
+
[
'required'
=>
[],
'optional'
=>
[]];
$this
->
migration_dependencies
=
(
$this
->
migration_dependencies
?:
[])
+
[
'required'
=>
[],
'optional'
=>
[]];
$this
->
migration_dependencies
[
'optional'
]
=
array_unique
(
array_merge
(
$this
->
migration_dependencies
[
'optional'
],
$this
->
findMigrationDependencies
(
$this
->
process
)));
return
$this
->
migration_dependencies
;
}
/**
* Find migration dependencies from the migration and the iterator plugins.
*
* @param $process
* @return array
*/
protected
function
findMigrationDependencies
(
$process
)
{
$return
=
[];
foreach
(
$this
->
getProcessNormalized
(
$process
)
as
$process_pipeline
)
{
foreach
(
$process_pipeline
as
$plugin_configuration
)
{
if
(
$plugin_configuration
[
'plugin'
]
==
'migration'
)
{
$return
=
array_merge
(
$return
,
(
array
)
$plugin_configuration
[
'migration'
]);
}
if
(
$plugin_configuration
[
'plugin'
]
==
'iterator'
)
{
$return
=
array_merge
(
$return
,
$this
->
findMigrationDependencies
(
$plugin_configuration
[
'process'
]));
}
}
}
return
$return
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php
+
21
−
4
View file @
97642595
...
...
@@ -33,10 +33,27 @@ public function testGetProcessPlugins() {
* @covers ::getMigrationDependencies
*/
public
function
testGetMigrationDependencies
()
{
$migration
=
\Drupal
::
service
(
'plugin.manager.migration'
)
->
createStubMigration
([
'migration_dependencies'
=>
NULL
]);
$this
->
assertNotEmpty
(
$migration
->
getMigrationDependencies
(),
'Migration dependencies is not empty'
);
$plugin_manager
=
\Drupal
::
service
(
'plugin.manager.migration'
);
$plugin_definition
=
[
'process'
=>
[
'f1'
=>
'bar'
,
'f2'
=>
[
'plugin'
=>
'migration'
,
'migration'
=>
'm1'
],
'f3'
=>
[
'plugin'
=>
'iterator'
,
'process'
=>
[
'target_id'
=>
[
'plugin'
=>
'migration'
,
'migration'
=>
'm2'
,
],
],
],
],
];
$migration
=
$plugin_manager
->
createStubMigration
(
$plugin_definition
);
$this
->
assertSame
([
'required'
=>
[],
'optional'
=>
[
'm1'
,
'm2'
]],
$migration
->
getMigrationDependencies
());
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment