diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index c0949f7..622c7ee 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -9,7 +9,6 @@ use Drupal\Core\TypedData\AccessibleInterface; use Drupal\Core\TypedData\ComplexDataInterface; -use Drupal\Core\TypedData\IdentifiableInterface; use Drupal\Core\TypedData\TranslatableInterface; /** @@ -28,7 +27,7 @@ * @see \Drupal\Core\TypedData\TypedDataManager * @see \Drupal\Core\Field\FieldInterface */ -interface EntityInterface extends IdentifiableInterface, ComplexDataInterface, AccessibleInterface, TranslatableInterface { +interface EntityInterface extends ComplexDataInterface, AccessibleInterface, TranslatableInterface { /** * Returns the entity UUID (Universally Unique Identifier). @@ -42,6 +41,14 @@ public function uuid(); /** + * Returns the identifier. + * + * @return string|int|null + * The object identifier, or NULL if the object does not yet have an identifier. + */ + public function id(); + + /** * Returns whether the entity is new. * * Usually an entity is new if no ID exists for it yet. However, entities may diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageReference.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageReference.php index 8d143a7..a4c061f 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageReference.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageReference.php @@ -36,4 +36,12 @@ public function getTargetDefinition() { 'type' => 'language', ); } + + /** + * {@inheritdoc} + */ + public function getTargetIdentifier() { + $language = $this->getTarget(); + return isset($language) ? $language->id() : NULL; + } } diff --git a/core/lib/Drupal/Core/TypedData/DataReferenceBase.php b/core/lib/Drupal/Core/TypedData/DataReferenceBase.php index 8e67a24..22d8f32 100644 --- a/core/lib/Drupal/Core/TypedData/DataReferenceBase.php +++ b/core/lib/Drupal/Core/TypedData/DataReferenceBase.php @@ -56,12 +56,4 @@ public function setValue($value, $notify = TRUE) { public function getString() { return (string) $this->getType() . ':' . $this->getTargetIdentifier(); } - - /** - * {@inheritdoc} - */ - public function getTargetIdentifier() { - $target = $this->getTarget(); - return isset($target) ? $target->id() : NULL; - } } diff --git a/core/lib/Drupal/Core/TypedData/IdentifiableInterface.php b/core/lib/Drupal/Core/TypedData/IdentifiableInterface.php deleted file mode 100644 index 09f8c92..0000000 --- a/core/lib/Drupal/Core/TypedData/IdentifiableInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -