diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 319881e..fffd0df 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -42,13 +42,6 @@ protected $bundle; /** - * Local cache holding the value of the ID key name from annotation. - * - * @var string - */ - protected $idKeyName; - - /** * The plain data values of the contained fields. * * This always holds the original, unchanged values of the entity. The values diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 5a5532f..4ef878d 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -17,6 +17,13 @@ abstract class Entity implements EntityInterface { /** + * Local cache holding the value of the ID key name from annotation. + * + * @var string + */ + protected $idKeyName; + + /** * The language code of the entity's default language. * * @var string @@ -72,7 +79,10 @@ public function __construct(array $values, $entity_type) { * {@inheritdoc} */ public function id() { - return isset($this->id) ? $this->id : NULL; + if (!isset($this->idKeyName)) { + $this->idKeyName = $this->entityInfo()->getKey('id'); + } + return isset($this->{$this->idKeyName}) ? $this->{$this->idKeyName} : NULL; } /** diff --git a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php index 27346c9..1d6bbd6 100644 --- a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php @@ -58,13 +58,6 @@ class Editor extends ConfigEntityBase implements EditorInterface { public $image_upload = array(); /** - * Overrides Drupal\Core\Entity\Entity::id(). - */ - public function id() { - return $this->format; - } - - /** * Overrides Drupal\Core\Entity\Entity::__construct() */ public function __construct(array $values, $entity_type) { diff --git a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php index 0bb5dec..e93709a 100644 --- a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php @@ -135,13 +135,6 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface { /** * {@inheritdoc} */ - public function id() { - return $this->format; - } - - /** - * {@inheritdoc} - */ public function filters($instance_id = NULL) { if (!isset($this->filterBag)) { $this->filterBag = new FilterBag(\Drupal::service('plugin.manager.filter'), $this->filters); diff --git a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php index 57869d4..2709d2d 100644 --- a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php +++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php @@ -89,13 +89,6 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface { protected $effectsBag; /** - * Overrides Drupal\Core\Entity\Entity::id(). - */ - public function id() { - return $this->name; - } - - /** * {@inheritdoc} */ public function postSave(EntityStorageControllerInterface $storage_controller, $update = TRUE) { diff --git a/core/modules/node/lib/Drupal/node/Entity/NodeType.php b/core/modules/node/lib/Drupal/node/Entity/NodeType.php index 99c5267..601c78b 100644 --- a/core/modules/node/lib/Drupal/node/Entity/NodeType.php +++ b/core/modules/node/lib/Drupal/node/Entity/NodeType.php @@ -135,13 +135,6 @@ class NodeType extends ConfigEntityBase implements NodeTypeInterface { /** * {@inheritdoc} */ - public function id() { - return $this->type; - } - - /** - * {@inheritdoc} - */ public function getModuleSettings($module) { if (isset($this->settings[$module]) && is_array($this->settings[$module])) { return $this->settings[$module]; diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php index 12facd4..5a76a9a 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php @@ -92,13 +92,6 @@ class Vocabulary extends ConfigEntityBase implements VocabularyInterface { /** * {@inheritdoc} */ - public function id() { - return $this->vid; - } - - /** - * {@inheritdoc} - */ public function postSave(EntityStorageControllerInterface $storage_controller, $update = TRUE) { parent::postSave($storage_controller, $update);