diff -u b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php --- b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentComplete.php @@ -55,11 +55,18 @@ $revision_id = $old_destination_id_values ? $old_destination_id_values[1] : $row->getDestinationProperty($this->getKey('revision')); + // If we are re-running a migration with set revision IDs and the + // destination revision ID already exists then do not create a new revision. if (!empty($revision_id) && ($entity = $this->storage->loadRevision($revision_id))) { $entity->setNewRevision(FALSE); } elseif (($entity_id = $row->getDestinationProperty($this->getKey('id'))) && ($entity = $this->storage->load($entity_id))) { + // We want to create a new entity. Set enforceIsNew() FALSE is necessary + // to properly save a new entity while setting the ID. Without it, the + // system would see that the ID is already set and assume it is an update. $entity->enforceIsNew(FALSE); + // Intentionally create a new revision. Setting new revision TRUE here may + // not be necessary, it is done for clarity. $entity->setNewRevision(TRUE); } else { @@ -85,6 +92,10 @@ // other translations. /** @var \Drupal\Core\Entity\ContentEntityInterface|\Drupal\Core\Entity\EntityChangedInterface $entity */ foreach ($entity->getTranslationLanguages() as $langcode => $language) { + // If we updated an untranslated field, then set the changed time for + // for all translations to match the current row that we are saving. + // In this context, getChangedTime() should return the value we just + // set in the updateEntity() call above. if ($entity->getTranslation($langcode)->hasTranslationChanges()) { $entity->getTranslation($langcode)->setChangedTime($entity->getChangedTime()); } diff -u b/core/modules/node/node.module b/core/modules/node/node.module --- b/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1467,13 +1467,12 @@ * Implements hook_migration_plugins_alter(). */ function node_migration_plugins_alter(array &$definitions) { - // If the complete node migrate_map tables have data then the any migration - // use a node migration in a migration_lookup needs to be altered to use - // both the classic and complete node migration. - if ((new NodeMigrateType)->getNodeMigrateType($definitions, NULL) !== NodeMigrateType::NODE_MIGRATE_TYPE_CLASSIC) { - + // If this is complete node migration then for of migrations, except the + // classic node migrations, replace the dependency on a classic node migration + // with a dependency on the complete node migration. + if ((new NodeMigrateType)->getNodeMigrateType($definitions, NULL) == NodeMigrateType::NODE_MIGRATE_TYPE_COMPLETE) { // Anonymous function to replace classic node migration plugin IDs with the - // complete plugin ID. + // node complete plugin ID. $replace_with_complete_migration = function (&$value) { if (is_string($value)) { $value = preg_replace('/d([67])_(node|node_translation|node_revision|node_entity_translation)($|:.*)/', 'd$1_node_complete$3', $value); diff -u b/core/modules/statistics/migrations/statistics_node_counter.yml b/core/modules/statistics/migrations/statistics_node_counter.yml --- b/core/modules/statistics/migrations/statistics_node_counter.yml +++ b/core/modules/statistics/migrations/statistics_node_counter.yml @@ -29,6 +29,4 @@ migration_dependencies: optional: - - d6_node_complete - - d7_node_complete - d6_node - d7_node