diff --git a/core/modules/migrate/src/Plugin/migrate/process/Migration.php b/core/modules/migrate/src/Plugin/migrate/process/Migration.php index 5787b37..64dd74f 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/Migration.php +++ b/core/modules/migrate/src/Plugin/migrate/process/Migration.php @@ -11,6 +11,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\migrate\MigrateException; +use Drupal\migrate\MigrateSkipProcessException; use Drupal\migrate\MigrateSkipRowException; use Drupal\migrate\Plugin\MigrateIdMapInterface; use Drupal\migrate\Plugin\MigratePluginManager; @@ -76,6 +77,7 @@ public function transform($value, MigrateExecutable $migrate_executable, Row $ro $scalar = TRUE; $value = array($value); } + $this->skipOnEmpty($value); $self = FALSE; /** @var \Drupal\migrate\Entity\MigrationInterface[] $migrations */ $migrations = $this->migrationStorage->loadMultiple($migration_ids); @@ -147,4 +149,18 @@ public function transform($value, MigrateExecutable $migrate_executable, Row $ro throw new MigrateSkipRowException(); } + /** + * Skip the migration process entirely if the value is FALSE. + * + * @param mixed $value + * The incoming value to transform. + * + * @throws \Drupal\migrate\MigrateSkipProcessException + */ + protected function skipOnEmpty($value) { + if (!array_filter($value)) { + throw new MigrateSkipProcessException(); + } + } + } diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment.yml index 4cfea2f..dc38654 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment.yml @@ -9,29 +9,17 @@ source: process: cid: cid pid: - - - plugin: skip_process_on_empty - source: pid - - - plugin: migration - migration: d6_comment - entity_id: plugin: migration - migration: d6_node - source: nid + migration: d6_comment + source: pid + entity_id: nid entity_type: 'constants/entity_type' # field_name & comment_type is calculated in # \Drupal\migrate_drupal\Plugin\migrate\source\d6\Comment::prepareRow() field_name: field_name comment_type: comment_type subject: subject - uid: - - - plugin: skip_process_on_empty - source: uid - - - plugin: migration - migration: d6_user + uid: uid name: name mail: mail homepage: homepage diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_profile_values.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_profile_values.yml index d6d0ab7..da0395e 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_profile_values.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_profile_values.yml @@ -7,10 +7,7 @@ source: load: plugin: drupal_entity process: - uid: - plugin: migration - migration: d6_user - source: uid + uid: uid destination: plugin: entity:user migration_dependencies: