Process plugin: skip_on_empty

Last updated on
13 October 2016

This plugin checks to see if the current pipeline value is empty (for example the empty string, FALSE, or 0). 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.

Example of usage for method: row:

process:
  field_type_exists:
    -
      plugin: migration
      migration: d6_field
      source:
        - field_name
    -
      plugin: skip_on_empty
      method: row
    -
      plugin: extract
      index:
        - 1

Examples of usage for method: process:

process:
  parent:
    -
      plugin: skip_on_empty
      method: process
      source: parent
    -
      plugin: migration
      migration: d6_taxonomy_term

or

process:
  book.pid:
    -
      plugin: skip_on_empty
      method: process
      source: plid
    -
      plugin: migration
      migration: d6_book

or

process:
  pid:
    -
      plugin: skip_on_empty
      method: process
      source: pid
    -
      plugin: migration
      migration: d6_comment