diff -u b/core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php b/core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php --- b/core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php +++ b/core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php @@ -9,29 +9,24 @@ use Drupal\migrate\MigrateSkipRowException; /** - * Skips processing the current row when the source value evaluates to empty. + * Skips processing the current row when the input value is empty. * - * The skip_on_empty process plugin checks to see if the current pipeline value - * is empty (for example the empty string, FALSE, or 0). If so, the further + * The skip_on_empty process plugin checks to see if the current input value + * is empty (empty string, NULL, FALSE, 0, '0', or an empty array). If so, the further * processing of the property or the entire row (depending on the chosen method) * is skipped and will not be migrated. * - * To skip the processing of the property when an empty value is encountered, - * use the method: process setting. - * This is useful when migrating parent values. When the parent source value is - * 0 or empty, which represents the root element, there is no need to set a - * destination value. In the other case a parent exists and needs a migration - * lookup. - * - * To skip the entire row when an empty value is encountered, use the method: - * row setting. - * this is useful when combined with a migration process plugin to check if a - * related item was previously migrated. + * Available configuration keys: + * - method: (optional) level of skip. + * - row: Skips the entire row when an empty value is encountered. Useful when + * combined with a migration process plugin to check if a related item + * was previously migrated. + * - process: Skips the processing of the property when an empty value is + * encountered. Useful when migrating parent values, there is no need to + * set a destination value. * * Examples: * - * Example of usage for method: row: - * * @code * process: * field_type_exists: @@ -49,7 +44,7 @@ * - 1 * @endcode * - * Examples of usage for method: process: + * If field_name is empty, skips the row process. * * @code * process: @@ -63,7 +58,10 @@ * migration: d6_taxonomy_term * @endcode * - * or + * If parent is empty, skips parent process but d6_taxonomy_term will be + * processed. + * + * Another example for process: * * @code * process: @@ -100,7 +98,8 @@ class SkipOnEmpty extends ProcessPluginBase { /** - * Performs the associated process. + * Skips migration process at row level when value is not set and throws a + * MigrateSkipRowException with STATUS_IGNORED status. * * @param mixed $value * The input value. @@ -116,6 +115,8 @@ * The sub string of $value. * * @throws \Drupal\migrate\MigrateSkipRowException + * Thrown if source property is not set and row should be skipped, by + * default records with STATUS_IGNORED status in the map. */ public function row($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (!$value) { @@ -125,7 +126,8 @@ } /** - * Performs the associated process. + * Skips migration process at process level when value is not set and throws a + * MigrateSkipProcessException. * * @param mixed $value * The input value. @@ -135,12 +137,14 @@ * The row from the source to process. * @param string $destination_property * The destination property currently worked on. This is only used together - * with the $row above. + * with the $row above. * * @return string * The sub string of $value. * * @throws \Drupal\migrate\MigrateSkipProcessException + * Thrown if source property is not set and rest of the process should be + * skipped. */ public function process($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (!$value) {