diff --git a/migration_helpers.module b/migration_helpers.module index 4710a58..ce46bac 100644 --- a/migration_helpers.module +++ b/migration_helpers.module @@ -90,6 +90,11 @@ function migration_helpers_move_terms( $new_term->save(); $tid = $new_term->id(); \Drupal::logger('mass')->log(LogLevel::INFO, "Term $term_name created with TID $tid in vocabulary $destination_vocabulary."); + + // Because we did the query only once, before we entered this loop, we + // need to add our newly created terms to the term data array we use to + // check for existing terms… or we'll keep creating duplicates. + $term_data[$new_term->id()] = $new_term->label(); } $tids[] = $tid; }