From c6702e9dffbed70824cc9b4720d94ca0cd86bb41 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Fri, 27 Sep 2013 14:47:28 +0200 Subject: [PATCH] Issue #2095587 by dixon_: #HardProblems DX conclusion: Remove IdentifiableInterface. --- .../Drupal/Core/Entity/EntityInterface.php | 12 ++++++++-- .../Plugin/DataType/LanguageReference.php | 8 +++++++ .../Core/TypedData/DataReferenceBase.php | 8 ------- .../Core/TypedData/IdentifiableInterface.php | 22 ------------------- .../TypedData/Plugin/DataType/Language.php | 3 +-- 5 files changed, 19 insertions(+), 34 deletions(-) delete mode 100644 core/lib/Drupal/Core/TypedData/IdentifiableInterface.php diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index c0949f71ac01..52ca07e2b30b 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). @@ -41,6 +40,15 @@ interface EntityInterface extends IdentifiableInterface, ComplexDataInterface, A */ public function uuid(); + /** + * Returns the identifier. + * + * @return string|int|null + * The entity identifier, or NULL if the object does not yet have an + * identifier. + */ + public function id(); + /** * Returns whether the entity is new. * diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageReference.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/LanguageReference.php index 8d143a75e90a..a4c061f464f3 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 8e67a2413cdf..22d8f3223406 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 09f8c927db75..000000000000 --- a/core/lib/Drupal/Core/TypedData/IdentifiableInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\Core\TypedData\IdentifiableInterface. - */ - -namespace Drupal\Core\TypedData; - -/** - * Interface for identifiable typed data. - */ -interface IdentifiableInterface { - - /** - * Returns the identifier. - * - * @return string|int|null - * The object identifier, or NULL if the object does not yet have an identifier. - */ - public function id(); -} diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php index 5ba5b0fc1b35..0b5a791df1dd 100644 --- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php +++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Language.php @@ -10,7 +10,6 @@ use Drupal\Core\TypedData\Annotation\DataType; use Drupal\Core\Annotation\Translation; use Drupal\Core\Language\Language as LanguageObject; -use Drupal\Core\TypedData\IdentifiableInterface; use Drupal\Core\TypedData\TypedData; /** @@ -26,7 +25,7 @@ * description = @Translation("A language object.") * ) */ -class Language extends TypedData implements IdentifiableInterface { +class Language extends TypedData { /** * The id of the language. -- GitLab