We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://www.drupal.org/node/3410921
Introduced in branch/version: 10.3.x / 10.3.0
The migration process plugin sub_process should catch MigrateSkipRowException exceptions.
sub_process
MigrateSkipRowException
For example, consider a migration like this (adapted from d7_filter_format):
d7_filter_format
source: plugin: d7_filter_format process: filters: plugin: sub_process source: filters key: '@id' process: id: plugin: filter_id bypass: true source: name map: editor_caption: filter_caption editor_align: filter_align destination: plugin: entity:filter_format
What happens if the filter_id process plugin throws a MigrateSkipRowException exception?
filter_id
The entire text format (filter_format entity) is skipped.
filter_format
Only the text filter being processed when the exception is thrown will be skipped.
Some migrations may have been written to rely on the bug. Such migrations can be rewritten with the help of some contributed modules.
The following process pipeline will check whether any rows were skipped in the sub process. If so, it will skip the current row of the main process.
dest_1: plugin: sub_process source: my_array_of_arrays # ... _bc_skip: - plugin: multiple_values source: - my_array_of_arrays - '@dest_1' - plugin: callback callable: count - plugin: single_value - plugin: callback callable: array_unique - plugin: callback callable: count - plugin: skip_on_value method: row value: 2
This process pipeline is similar, relying on the fact that PHP compares arrays using lengths: $array1 > $array2 if count($array1) > count($array2).
$array1 > $array2
count($array1) > count($array2)
dest_1: plugin: sub_process source: my_array_of_arrays process: property: plugin: something_that_might_skip source: array_key _bc_skip: plugin: skip_on_condition method: row message: 'BC forever!' source: my_array_of_arrays condition: plugin: greater_than property: '@dest_1'
dest_1: plugin: sub_process source: my_array_of_arrays process: property: plugin: something_that_might_skip source: array_key
_bc_skip: plugin: skip_on_condition method: row message: 'BC forever!' source: my_array_of_arrays condition: plugin: greater_than property: '@dest_1'
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://www.drupal.org/node/3410921
Introduced in branch/version: 10.3.x / 10.3.0
The migration process plugin
sub_process
should catchMigrateSkipRowException
exceptions.For example, consider a migration like this (adapted from
d7_filter_format
):What happens if the
filter_id
process plugin throws aMigrateSkipRowException
exception?Before Drupal 10.3.0
The entire text format (
filter_format
entity) is skipped.Starting with Drupal 10.3.0
Only the text filter being processed when the exception is thrown will be skipped.
Work arounds
Some migrations may have been written to rely on the bug. Such migrations can be rewritten with the help of some contributed modules.
Using Migrate Plus
The following process pipeline will check whether any rows were skipped in the sub process. If so, it will skip the current row of the main process.
Using Migrate Conditions
This process pipeline is similar, relying on the fact that PHP compares arrays using lengths:
$array1 > $array2
ifcount($array1) > count($array2)
.The text was updated successfully, but these errors were encountered: