Problem/Motivation
When we have something like:
process:
'body/format':
plugin: explode
delimiter: "|"
source: format
'body/value':
plugin: explode
delimiter: "|"
source: value
'body/summary':
plugin: explode
delimiter: "|"
source: teaser
in the migration yaml this will give a structure like this in the row destination:
[
body => [
'value' =>
[0] => [
'Body text 1',
]
[1] => [
'Body text 2',
]
]
...
]
]
When it should be:
[
body => [
[0] => [
'value' =>
'Body text 1',
]
...
]
[1] => [
'value' =>
'Body text 2',
]
...
]
]
]
All the destinations are configured as multiple because of this bug #2639556: InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values.. The explode process plugin is just an example.
When the destination array is wrong it throws an error
InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values.
and the migration fails for that row.
Proposed resolution
Make Drupal\migrate\Row::setDestinationProperty handle this special case by setting the parents correctly for
NestedArray::setValue
https://api.drupal.org/api/drupal/core!modules!migrate!src!Row.php/funct...
Remaining tasks
- Write tests.