diff --git a/core/includes/entity.inc b/core/includes/entity.inc index fa5f370c3362c737bb9a874943dfdd2343e98b86..51b0f7930849d1bd76b67449a184a1b431d37c65 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 87b43f7055956b3a2faa53b8d2675d9b3febf214..18e0260312f22f7f93635c74e811b511f32c8366 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); diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php index e8f80888f519f6f9c0ba8cf0579c94c8a787f43d..9a616932d94e3ed993bf89b69a393664ad35f291 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php @@ -48,6 +48,15 @@ public function getConfigPrefix() { return $this->provider . '.' . $config_prefix; } + /** + * {@inheritdoc} + */ + public function getKeys() { + // Always add a default 'uuid' key. + return array('uuid' => 'uuid') + parent::getKeys(); + } + + /** * {@inheritdoc} */ diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php index 48bef95d7cb252426c54347bd246e770b1e87a4d..59a473551b31e653813a15ef98d079f4f9e10499 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php @@ -48,13 +48,6 @@ class CustomBlockType extends ConfigEntityBase implements CustomBlockTypeInterfa */ public $id; - /** - * The custom block type UUID. - * - * @var string - */ - public $uuid; - /** * The custom block type label. * diff --git a/core/modules/block/lib/Drupal/block/Entity/Block.php b/core/modules/block/lib/Drupal/block/Entity/Block.php index c0d4de98b6b998f2b9b338539a0d468c0ed66c71..cb49cace169eb286f17c5f29530a5892c0f90b2a 100644 --- a/core/modules/block/lib/Drupal/block/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Entity/Block.php @@ -48,13 +48,6 @@ class Block extends ConfigEntityBase implements BlockInterface, EntityWithPlugin */ public $id; - /** - * The block UUID. - * - * @var string - */ - public $uuid; - /** * The plugin instance settings. * diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php index 08ae4b689a70a0beb02090cf218772b33b69719a..02c19450e9daed3c3fbb8cfd34c4375d8372424a 100644 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php @@ -51,13 +51,6 @@ class Breakpoint extends ConfigEntityBase implements BreakpointInterface { */ public $id; - /** - * The breakpoint UUID. - * - * @var string - */ - public $uuid; - /** * The breakpoint name (machine name) as specified by theme or module. * diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/BreakpointGroup.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/BreakpointGroup.php index f3807afe2f3d872630e90d2a8ac6a992752f476f..80f10e07a0f54399de7570152eb15bb30ad92f26 100644 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/BreakpointGroup.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/BreakpointGroup.php @@ -33,13 +33,6 @@ class BreakpointGroup extends ConfigEntityBase implements BreakpointGroupInterfa */ public $id; - /** - * The breakpoint group UUID. - * - * @var string - */ - public $uuid; - /** * The breakpoint group machine name. * diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php index 24be35e0eb1d4b157f69320680ee79662d264422..89413d2d053f28ba59ec4b5f6d728a0e1cfd800d 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php @@ -52,11 +52,11 @@ function testImport() { // Create new config entity. $original_dynamic_data = array( 'id' => 'new', - 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', 'label' => 'New', 'weight' => 0, 'style' => '', 'status' => TRUE, + 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', 'langcode' => language_default()->id, 'protected_property' => '', ); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php index f23cdcb182e29dc3c263718b4d895f4c7049a99d..b597aa7726ef48e05ad791fa9daaddad293df4d2 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php @@ -163,11 +163,11 @@ function testNew() { // Create new config entity. $original_dynamic_data = array( 'id' => 'new', - 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', 'label' => 'New', 'weight' => 0, 'style' => '', 'status' => TRUE, + 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', 'langcode' => language_default()->id, 'protected_property' => '', ); diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php index 1bb4deb3d1557ca37a542cb3a6cb80e207619392..029a7ac0af8ac8671c7e71ab6957ebe3dcc366e2 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php @@ -48,13 +48,6 @@ class ConfigTest extends ConfigEntityBase implements ConfigTestInterface { */ public $id; - /** - * The UUID for the configuration entity. - * - * @var string - */ - public $uuid; - /** * The human-readable name of the configuration entity. * diff --git a/core/modules/contact/lib/Drupal/contact/Entity/Category.php b/core/modules/contact/lib/Drupal/contact/Entity/Category.php index b2f24604bd9d9694a2a01183101adb7f5dbbaae5..a2fe218f6e6648d409ed051d79c8ce2c7439b12a 100644 --- a/core/modules/contact/lib/Drupal/contact/Entity/Category.php +++ b/core/modules/contact/lib/Drupal/contact/Entity/Category.php @@ -48,13 +48,6 @@ class Category extends ConfigEntityBase implements CategoryInterface { */ public $id; - /** - * The category UUID. - * - * @var string - */ - public $uuid; - /** * The category label. * diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php index 93d132d0517482def04335c79d36511cccb14dd5..150b73b57c714cdb3d5640d8e000870a482318b1 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php @@ -24,13 +24,6 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl */ public $id; - /** - * Unique UUID for the config entity. - * - * @var string - */ - public $uuid; - /** * Entity type to be displayed. * diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayModeBase.php index 1541143bb1d7f9305991d60f0e21752719f1e1a0..6705f03eb935672c683a16f8c19a14dc6ab34785 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayModeBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayModeBase.php @@ -21,13 +21,6 @@ abstract class EntityDisplayModeBase extends ConfigEntityBase implements EntityD */ public $id; - /** - * The UUID of the form or view mode. - * - * @var string - */ - public $uuid; - /** * The human-readable name of the form or view mode. * diff --git a/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php b/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php index 3388c9588e47c82bc739f449578580c615fdff87..9e8adee1631d1cb83c8c53ca9e08c04dfae72c95 100644 --- a/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php @@ -65,15 +65,6 @@ class FieldConfig extends ConfigEntityBase implements FieldConfigInterface { */ public $name; - /** - * The field UUID. - * - * This is assigned automatically when the field is created. - * - * @var string - */ - public $uuid; - /** * The name of the entity type the field can be attached to. * diff --git a/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php b/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php index e61896a28b40f49e9d6942fe6181a00ce8be2d46..cd784159891307f9944049a86820924e5d3bfedd 100644 --- a/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php @@ -44,15 +44,6 @@ class FieldInstanceConfig extends ConfigEntityBase implements FieldInstanceConfi */ public $id; - /** - * The instance UUID. - * - * This is assigned automatically when the instance is created. - * - * @var string - */ - public $uuid; - /** * The name of the field attached to the bundle by this instance. * diff --git a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php index 09e098fd579c4d31605af25be98f8739b0aa83c4..4e6febf46acf191c5cdb7e35506b56fcb58db418 100644 --- a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php @@ -68,13 +68,6 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface, En */ public $name; - /** - * The UUID for this entity. - * - * @var string - */ - public $uuid; - /** * Weight of this format in the text format selector. * diff --git a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php index ab7480b1dbdd2d15158b870da90ac505a2985365..02513549d73b56213d640cdb63a585779566c85f 100644 --- a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php +++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php @@ -68,13 +68,6 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, Entity */ public $label; - /** - * The UUID for this entity. - * - * @var string - */ - public $uuid; - /** * The array of image effects for this image style. * diff --git a/core/modules/language/lib/Drupal/language/Entity/Language.php b/core/modules/language/lib/Drupal/language/Entity/Language.php index 7c923518ab4076737594860e733fb204d32bab7b..c7ad236c86ab1611ea1ba6ec19dc7ddbdba733e8 100644 --- a/core/modules/language/lib/Drupal/language/Entity/Language.php +++ b/core/modules/language/lib/Drupal/language/Entity/Language.php @@ -49,15 +49,6 @@ class Language extends ConfigEntityBase implements LanguageInterface { */ public $id; - /** - * The language UUID. - * - * This is assigned automatically when the language is created. - * - * @var string - */ - public $uuid; - /** * The human-readable label for the language. * diff --git a/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php b/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php index 3967aec1f199eea37968d55d4ddfda6f8da957d2..587c8880424645ccaf5cce57129e6833feddc1dc 100644 --- a/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php +++ b/core/modules/migrate/lib/Drupal/migrate/Entity/Migration.php @@ -45,15 +45,6 @@ class Migration extends ConfigEntityBase implements MigrationInterface { */ public $id; - /** - * The migration UUID. - * - * This is assigned automatically when the migration is created. - * - * @var string - */ - public $uuid; - /** * The human-readable label for the migration. * diff --git a/core/modules/node/lib/Drupal/node/Entity/NodeType.php b/core/modules/node/lib/Drupal/node/Entity/NodeType.php index d8e413b3cf1a05d9ed737245600d1d37b3331655..d7fd3b0c30abc10f34f6bf33c050d3fd3c894a19 100644 --- a/core/modules/node/lib/Drupal/node/Entity/NodeType.php +++ b/core/modules/node/lib/Drupal/node/Entity/NodeType.php @@ -53,13 +53,6 @@ class NodeType extends ConfigEntityBase implements NodeTypeInterface { */ public $type; - /** - * The UUID of the node type. - * - * @var string - */ - public $uuid; - /** * The human-readable name of the node type. * diff --git a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php index ba1351d6efdefde5c6220e65872bef54291a841d..aa8b3322e8d6edbcdee7559725c6f1ffd5584457 100644 --- a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php +++ b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php @@ -47,13 +47,6 @@ class PictureMapping extends ConfigEntityBase implements PictureMappingInterface */ public $id; - /** - * The picture UUID. - * - * @var string - */ - public $uuid; - /** * The picture label. * diff --git a/core/modules/rdf/lib/Drupal/rdf/Entity/RdfMapping.php b/core/modules/rdf/lib/Drupal/rdf/Entity/RdfMapping.php index 19163205c3796425522c6bfe692acdb9db989bd4..2256dd42a57e79f63cc3061daa92d52b7000b75a 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Entity/RdfMapping.php +++ b/core/modules/rdf/lib/Drupal/rdf/Entity/RdfMapping.php @@ -32,13 +32,6 @@ class RdfMapping extends ConfigEntityBase implements RdfMappingInterface { */ public $id; - /** - * UUID for the config entity. - * - * @var string - */ - public $uuid; - /** * Entity type to be mapped. * diff --git a/core/modules/search/lib/Drupal/search/Entity/SearchPage.php b/core/modules/search/lib/Drupal/search/Entity/SearchPage.php index b992a765ee5ff57496d1f1a7c26095d66db5acc8..36444e01ede8862e4f17622919f9ebc43f7c4627 100644 --- a/core/modules/search/lib/Drupal/search/Entity/SearchPage.php +++ b/core/modules/search/lib/Drupal/search/Entity/SearchPage.php @@ -65,13 +65,6 @@ class SearchPage extends ConfigEntityBase implements SearchPageInterface, Entity */ public $label; - /** - * The UUID of the search page entity. - * - * @var string - */ - public $uuid; - /** * The configuration of the search page entity. * diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php b/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php index ce52aca3369d269aff662ea50e4b29b22812e07d..8e4381a59dbfc2ae2cf58e1d11d8ec26a58ab879 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php @@ -51,13 +51,6 @@ class ShortcutSet extends ConfigEntityBase implements ShortcutSetInterface { */ public $id; - /** - * The UUID for the configuration entity. - * - * @var string - */ - public $uuid; - /** * The human-readable name of the configuration entity. * diff --git a/core/modules/system/lib/Drupal/system/Entity/Action.php b/core/modules/system/lib/Drupal/system/Entity/Action.php index 972b4a34dde54eac162aff12febae071bf8fa59b..93b38f17084316e84678d08e9b2d083f2db1d8d3 100644 --- a/core/modules/system/lib/Drupal/system/Entity/Action.php +++ b/core/modules/system/lib/Drupal/system/Entity/Action.php @@ -42,13 +42,6 @@ class Action extends ConfigEntityBase implements ActionConfigEntityInterface, En */ public $label; - /** - * The UUID of the action. - * - * @var string - */ - public $uuid; - /** * The action type. * diff --git a/core/modules/system/lib/Drupal/system/Entity/DateFormat.php b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php index 71c24513f13d636ef07f17d71fc193206eb58b28..ce169b9a5188e2b044e07be4ce9249ab19f19064 100644 --- a/core/modules/system/lib/Drupal/system/Entity/DateFormat.php +++ b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php @@ -47,13 +47,6 @@ class DateFormat extends ConfigEntityBase implements DateFormatInterface { */ public $id; - /** - * The date format UUID. - * - * @var string - */ - public $uuid; - /** * The human-readable name of the date format entity. * diff --git a/core/modules/system/lib/Drupal/system/Entity/Menu.php b/core/modules/system/lib/Drupal/system/Entity/Menu.php index e8aecff5b68e8dd21cb8145ee8e8edfbccdcea39..b4abf10a1d120b9a0724fc3a887a3dec6b231b26 100644 --- a/core/modules/system/lib/Drupal/system/Entity/Menu.php +++ b/core/modules/system/lib/Drupal/system/Entity/Menu.php @@ -37,13 +37,6 @@ class Menu extends ConfigEntityBase implements MenuInterface { */ public $id; - /** - * The menu UUID. - * - * @var string - */ - public $uuid; - /** * The human-readable name of the menu entity. * diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php index c9bf8b63fa0c0f534ea74b58ab1f63bf7484ddb6..ee3d8f36dccffad94d713328e222661add892e8f 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php @@ -53,13 +53,6 @@ class Vocabulary extends ConfigEntityBase implements VocabularyInterface { */ public $vid; - /** - * The vocabulary UUID. - * - * @var string - */ - public $uuid; - /** * Name of the vocabulary. * diff --git a/core/modules/user/lib/Drupal/user/Entity/Role.php b/core/modules/user/lib/Drupal/user/Entity/Role.php index 49152e353e7829476f73e5db21f5b7fa445030ef..2a025d9d922cb1590146e369713e9992e0808bd6 100644 --- a/core/modules/user/lib/Drupal/user/Entity/Role.php +++ b/core/modules/user/lib/Drupal/user/Entity/Role.php @@ -50,13 +50,6 @@ class Role extends ConfigEntityBase implements RoleInterface { */ public $id; - /** - * The UUID of this role. - * - * @var string - */ - public $uuid; - /** * The human-readable label of this role. * diff --git a/core/modules/views/lib/Drupal/views/Entity/View.php b/core/modules/views/lib/Drupal/views/Entity/View.php index 62e5536bf7a83d72857a1aff4ba11e3d900e67e0..8eea4c15a9b90b5738548ef07e6a3dbdd0f647b0 100644 --- a/core/modules/views/lib/Drupal/views/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Entity/View.php @@ -95,13 +95,6 @@ class View extends ConfigEntityBase implements ViewStorageInterface { */ protected $base_field = 'nid'; - /** - * The UUID for this entity. - * - * @var string - */ - public $uuid = NULL; - /** * Stores a reference to the executable version of this view. *