Skip to content
Snippets Groups Projects
Commit c6702e9d authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2095587 by dixon_: #HardProblems DX conclusion: Remove IdentifiableInterface.

parent 82f8f24d
No related merge requests found
......@@ -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.
*
......
......@@ -36,4 +36,12 @@ public function getTargetDefinition() {
'type' => 'language',
);
}
/**
* {@inheritdoc}
*/
public function getTargetIdentifier() {
$language = $this->getTarget();
return isset($language) ? $language->id() : NULL;
}
}
......@@ -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;
}
}
<?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();
}
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment