diff --git a/core/includes/entity.api.php b/core/includes/entity.api.php index bb193d9..fbc9492 100644 --- a/core/includes/entity.api.php +++ b/core/includes/entity.api.php @@ -5,6 +5,8 @@ * Hooks provided the Entity module. */ +use Drupal\Core\Entity\ContentEntityInterface; + /** * @addtogroup hooks * @{ @@ -171,7 +173,7 @@ function hook_entity_info_alter(&$entity_info) { * The entity object. */ function hook_entity_create(\Drupal\Core\Entity\EntityInterface $entity) { - if ($entity instanceof \Drupal\Core\Entity\ContentEntityBase && !$entity->foo->value) { + if ($entity instanceof ContentEntityInterface && !$entity->foo->value) { $entity->foo->value = 'some_initial_value'; } } diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 397a6f3..ec74ed7 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -13,14 +13,6 @@ /** * Implements Entity Field API specific enhancements to the Entity class. - * - * Entity(..)NG classes are variants of the Entity(...) classes that implement - * the next generation (NG) entity field API. They exist during conversion to - * the new API only and changes will be merged into the respective original - * classes once the conversion is complete. - * - * @todo: Once all entity types have been converted, merge improvements into the - * Entity class and overhaul the EntityInterface. */ abstract class ContentEntityBase extends Entity implements \IteratorAggregate, ContentEntityInterface { @@ -233,7 +225,7 @@ public function getValue() { } /** - * Implements \Drupal\Core\TypedData\TypedDataInterface::setValue(). + * {@inheritdoc} */ public function setValue($value, $notify = TRUE) { // @todo: This does not make much sense, so remove once TypedDataInterface @@ -273,35 +265,35 @@ public function getConstraints() { } /** - * Implements \Drupal\Core\TypedData\TypedDataInterface::getName(). + * {@inheritdoc} */ public function getName() { return NULL; } /** - * Implements \Drupal\Core\TypedData\TypedDataInterface::getRoot(). + * {@inheritdoc} */ public function getRoot() { return $this; } /** - * Implements \Drupal\Core\TypedData\TypedDataInterface::getPropertyPath(). + * {@inheritdoc} */ public function getPropertyPath() { return ''; } /** - * Implements \Drupal\Core\TypedData\TypedDataInterface::getParent(). + * {@inheritdoc} */ public function getParent() { return NULL; } /** - * Implements \Drupal\Core\TypedData\TypedDataInterface::setContext(). + * {@inheritdoc} */ public function setContext($name = NULL, TypedDataInterface $parent = NULL) { // As entities are always the root of the tree of typed data, we do not need @@ -337,14 +329,14 @@ public function __wakeup() { } /** - * Implements \Drupal\Core\Entity\EntityInterface::id(). + * {@inheritdoc} */ public function id() { return $this->id->value; } /** - * Implements \Drupal\Core\Entity\EntityInterface::bundle(). + * {@inheritdoc} */ public function bundle() { return $this->bundle; @@ -413,7 +405,7 @@ protected function uriPlaceholderReplacements() { } /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::get(). + * {@inheritdoc} */ public function get($property_name) { if (!isset($this->fields[$property_name][$this->activeLangcode])) { @@ -458,14 +450,14 @@ protected function getTranslatedField($property_name, $langcode) { } /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::set(). + * {@inheritdoc} */ public function set($property_name, $value, $notify = TRUE) { $this->get($property_name)->setValue($value, FALSE); } /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::getProperties(). + * {@inheritdoc} */ public function getProperties($include_computed = FALSE) { $properties = array(); @@ -478,14 +470,14 @@ public function getProperties($include_computed = FALSE) { } /** - * Implements \IteratorAggregate::getIterator(). + * {@inheritdoc} */ public function getIterator() { return new \ArrayIterator($this->getProperties()); } /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinition(). + * {@inheritdoc} */ public function getPropertyDefinition($name) { if (!isset($this->fieldDefinitions)) { @@ -500,7 +492,7 @@ public function getPropertyDefinition($name) { } /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions(). + * {@inheritdoc} */ public function getPropertyDefinitions() { if (!isset($this->fieldDefinitions)) { @@ -511,7 +503,7 @@ public function getPropertyDefinitions() { } /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyValues(). + * {@inheritdoc} */ public function getPropertyValues() { $values = array(); @@ -522,7 +514,7 @@ public function getPropertyValues() { } /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::setPropertyValues(). + * {@inheritdoc} */ public function setPropertyValues($values) { foreach ($values as $name => $value) { @@ -531,7 +523,7 @@ public function setPropertyValues($values) { } /** - * Implements \Drupal\Core\TypedData\ComplexDataInterface::isEmpty(). + * {@inheritdoc} */ public function isEmpty() { if (!$this->isNew()) { @@ -608,7 +600,7 @@ public function onChange($property_name) { } /** - * Implements \Drupal\Core\TypedData\TranslatableInterface::getTranslation(). + * {@inheritdoc} * * @return \Drupal\Core\Entity\EntityInterface */ diff --git a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php index b9736e74..60a110c 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityFormController.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityFormController.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\Core\Entity\EntityFormControllerNG. + * Contains \Drupal\Core\Entity\ContentEntityFormController. */ namespace Drupal\Core\Entity; @@ -17,7 +17,7 @@ class ContentEntityFormController extends EntityFormController { /** - * Overrides EntityFormController::form(). + * {@inheritdoc} */ public function form(array $form, array &$form_state) { $entity = $this->entity; @@ -35,7 +35,7 @@ public function form(array $form, array &$form_state) { } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::validate(). + * {@inheritdoc} */ public function validate(array $form, array &$form_state) { $entity = $this->buildEntity($form, $form_state); @@ -92,7 +92,7 @@ protected function getTranslatedEntity(array $form_state) { } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::getFormLangcode(). + * {@inheritdoc} */ public function getFormLangcode(array $form_state) { $entity = $this->entity; @@ -124,14 +124,14 @@ public function getFormLangcode(array $form_state) { } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::isDefaultFormLangcode(). + * {@inheritdoc} */ public function isDefaultFormLangcode(array $form_state) { return $this->getFormLangcode($form_state) == $this->entity->getUntranslated()->language()->id; } /** - * Overrides EntityFormController::buildEntity(). + * {@inheritdoc} */ public function buildEntity(array $form, array &$form_state) { $entity = clone $this->entity; diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index 3a13441..570dfe5 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -262,7 +262,7 @@ protected function actions(array $form, array &$form_state) { } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::validate(). + * {@inheritdoc} */ public function validate(array $form, array &$form_state) { // @todo Remove this. @@ -272,7 +272,7 @@ public function validate(array $form, array &$form_state) { } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::submit(). + * {@inheritdoc} * * This is the default entity object builder function. It is called before any * other submit handler to build the new entity object to be passed to the @@ -326,7 +326,7 @@ public function getFormLangcode(array $form_state) { } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::isDefaultFormLangcode(). + * {@inheritdoc} */ public function isDefaultFormLangcode(array $form_state) { // The entity is not translatable, this is always the default language. @@ -347,7 +347,7 @@ protected function updateFormLangcode(array &$form_state) { } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::buildEntity(). + * {@inheritdoc} */ public function buildEntity(array $form, array &$form_state) { $entity = clone $this->entity; @@ -362,14 +362,14 @@ public function buildEntity(array $form, array &$form_state) { } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::getEntity(). + * {@inheritdoc} */ public function getEntity() { return $this->entity; } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::setEntity(). + * {@inheritdoc} */ public function setEntity(EntityInterface $entity) { $this->entity = $entity; @@ -418,7 +418,7 @@ public function setFormDisplay(EntityFormDisplayInterface $form_display, array & } /** - * Implements \Drupal\Core\Entity\EntityFormControllerInterface::getOperation(). + * {@inheritdoc} */ public function getOperation() { return $this->operation; diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index 7bfef80..e108c70 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -237,69 +237,4 @@ public function createDuplicate(); */ public function entityInfo(); - /** -<<<<<<< HEAD - * Returns the revision identifier of the entity. - * - * @return - * The revision identifier of the entity, or NULL if the entity does not - * have a revision identifier. - */ - public function getRevisionId(); - - /** - * Checks if this entity is the default revision. - * - * @param bool $new_value - * (optional) A Boolean to (re)set the isDefaultRevision flag. - * - * @return bool - * TRUE if the entity is the default revision, FALSE otherwise. If - * $new_value was passed, the previous value is returned. - */ - public function isDefaultRevision($new_value = NULL); - - /** - * Retrieves the exportable properties of the entity. - * - * @return array - * An array of exportable properties and their values. - */ - public function getExportProperties(); - - /** - * Returns the translation support status. - * - * @return bool - * TRUE if the entity bundle has translation support enabled. - */ - public function isTranslatable(); - - /** - * Marks the translation identified by the given language code as existing. - * - * @todo Remove this as soon as translation metadata have been converted to - * regular fields. - * - * @param string $langcode - * The language code identifying the translation to be initialized. - */ - public function initTranslation($langcode); - - /** - * Defines the base fields of the entity type. - * - * @param string $entity_type - * The entity type to return properties for. Useful when a single class is - * used for multiple, possibly dynamic entity types. - * - * @return array - * An array of entity field definitions as specified by - * \Drupal\Core\Entity\EntityManager::getFieldDefinitions(), keyed by field - * name. - * - * @see \Drupal\Core\Entity\EntityManager::getFieldDefinitions() - */ - public static function baseFieldDefinitions($entity_type); - }