diff --git a/core/includes/entity.inc b/core/includes/entity.inc index fa5f370..51b0f79 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -241,11 +241,7 @@ function entity_revision_delete($entity_type, $revision_id) { function entity_load_by_uuid($entity_type_id, $uuid, $reset = FALSE) { $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id); - // Configuration entities do not use annotations to set the UUID key. - if ($entity_type->isSubclassOf('Drupal\Core\Config\Entity\ConfigEntityInterface')) { - $uuid_key = 'uuid'; - } - elseif (!$uuid_key = $entity_type->getKey('uuid')) { + if (!$uuid_key = $entity_type->getKey('uuid')) { throw new EntityStorageException("Entity type $entity_type_id does not support UUIDs."); } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index 87b43f7..18e0260 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -174,11 +174,7 @@ public function isSyncing() { * {@inheritdoc} */ public function createDuplicate() { - $duplicate = clone $this; - $duplicate->set($this->getEntityType()->getKey('id'), NULL); - - // @todo Inject the UUID service into the Entity class once possible. - $duplicate->set('uuid', \Drupal::service('uuid')->generate()); + $duplicate = parent::createDuplicate(); // Prevent the new duplicate from being misinterpreted as a rename. $duplicate->setOriginalId(NULL);