Skip to main content

Devbit

Skip migrating row if the value is an empty array

The single_value plugin is necessary since the skip_on_empty plugin doesn't work with an empty array properly. See Issue: https://www.drupal.org/project/drupal/issues/3239410
  skip_on_empty_array:
  -
    plugin: single_value
    source: file_path
  -
    plugin: skip_on_empty
    method: row

Issue:

The single_value plugin is necessary since the skip_on_empty plugin doesn't work with an empty array properly. See Issue: https://www.drupal.org/project/drupal/issues/3239410 

Prerequisites:

The migrate_plus module needs to be enabled.

Solution:

The provided snippet skips the row if the value is an empty array.

Profilfoto Nikolas Kopp

Nikolas Kopp

Senior Backend Developer / DevOps

Ihre Drupal-Website zukunftssicher machen

Wir prüfen Ihr System und zeigen, was Sie für AI, Wartung und Upgrades brauchen.