diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 1784558..a02c803 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -843,6 +843,7 @@ public function __clone() { // Avoid deep-cloning when we are initializing a translation object, since // it will represent the same entity, only with a different active language. if (!$this->translationInitialize) { + // The translation is a different object, and needs its own TypedData object. $this->typedData = NULL; $definitions = $this->getFieldDefinitions(); foreach ($this->fields as $name => $values) { diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index cb3e130..6778836 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -22,6 +22,7 @@ * Defines a base entity class. */ abstract class Entity implements EntityInterface { + use DependencySerializationTrait { __sleep as traitSleep; } diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/Entity.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/Entity.php index 1f9ffbf..17f50f6 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DataType/Entity.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/Entity.php @@ -20,7 +20,8 @@ * * Instances of this class wrap entity objects and allow to deal with entities * based upon the Typed Data API. - * In addition to the "entity" data type, there is derivative which exposes + * + * In addition to the "entity" data type, this exposes derived * "entity:$entity_type" and "entity:$entity_type:$bundle" data types. * * @DataType( diff --git a/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php b/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php index 2094d8e..30a63a2 100644 --- a/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php +++ b/core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php @@ -57,7 +57,7 @@ public static function createFromDataType($data_type) { public function getPropertyDefinitions() { if (!isset($this->propertyDefinitions)) { if ($entity_type_id = $this->getEntityTypeId()) { - // Return an empty array for entity types that don't support typed data. + // Return an empty array for entities that are not content entities. $entity_type_class = \Drupal::entityManager()->getDefinition($entity_type_id)->getClass(); if (!in_array('Drupal\Core\Entity\ContentEntityInterface', class_implements($entity_type_class))) { $this->propertyDefinitions = array(); @@ -94,7 +94,7 @@ public function getDataType() { if (($bundles = $this->getBundles()) && count($bundles) == 1) { $bundle = reset($bundles); if ($bundle != $entity_type) { - $type .= ':' . reset($bundles); + $type .= ':' . $bundle; } } } diff --git a/core/lib/Drupal/Core/Field/FieldItemList.php b/core/lib/Drupal/Core/Field/FieldItemList.php index 7b50791..f6ae7d5 100644 --- a/core/lib/Drupal/Core/Field/FieldItemList.php +++ b/core/lib/Drupal/Core/Field/FieldItemList.php @@ -57,6 +57,8 @@ public function __construct(DataDefinitionInterface $definition, $name = NULL, T * {@inheritdoc} */ public function getEntity() { + // The "parent" is the TypedData object for the entity, we need to unwrap + // the actual entity. return $this->getParent()->getValue(); } diff --git a/core/lib/Drupal/Core/TypedData/ComplexDataInterface.php b/core/lib/Drupal/Core/TypedData/ComplexDataInterface.php index 2e5dfd6..1397485 100644 --- a/core/lib/Drupal/Core/TypedData/ComplexDataInterface.php +++ b/core/lib/Drupal/Core/TypedData/ComplexDataInterface.php @@ -36,7 +36,7 @@ * * @throws \InvalidArgumentException * If an invalid property name is given. - * @throws \Drupal\Core\TypedData\MissingDataException + * @throws \Drupal\Core\TypedData\Exception\MissingDataException * If the complex data structure is unset and no property can be created. */ public function get($property_name); @@ -58,7 +58,7 @@ public function get($property_name); * * @throws \InvalidArgumentException * If the specified property does not exist. - * @throws \Drupal\Core\TypedData\MissingDataException + * @throws \Drupal\Core\TypedData\Exception\MissingDataException * If the complex data structure is unset and no property can be set. */ public function set($property_name, $value, $notify = TRUE); @@ -73,7 +73,7 @@ public function set($property_name, $value, $notify = TRUE); * An array of property objects implementing the TypedDataInterface, keyed * by property name. * - * @throws \Drupal\Core\TypedData\MissingDataException + * @throws \Drupal\Core\TypedData\Exception\MissingDataException * If the complex data structure is unset and no property can be created. */ public function getProperties($include_computed = FALSE); @@ -87,7 +87,7 @@ public function getProperties($include_computed = FALSE); * @return array * An array of property values, keyed by property name. * - * @throws \Drupal\Core\TypedData\MissingDataException + * @throws \Drupal\Core\TypedData\Exception\MissingDataException * If the complex data structure is unset and no property can be created. */ public function toArray(); diff --git a/core/lib/Drupal/Core/TypedData/Exception/ReadOnlyException.php b/core/lib/Drupal/Core/TypedData/Exception/ReadOnlyException.php index d3e0371..ffd4296 100644 --- a/core/lib/Drupal/Core/TypedData/Exception/ReadOnlyException.php +++ b/core/lib/Drupal/Core/TypedData/Exception/ReadOnlyException.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\Core\TypedData\ReadOnlyException. + * Contains \Drupal\Core\TypedData\Exception\ReadOnlyException. */ namespace Drupal\Core\TypedData\Exception; diff --git a/core/lib/Drupal/Core/TypedData/ListInterface.php b/core/lib/Drupal/Core/TypedData/ListInterface.php index 67d6a16..ce59dfb 100644 --- a/core/lib/Drupal/Core/TypedData/ListInterface.php +++ b/core/lib/Drupal/Core/TypedData/ListInterface.php @@ -58,7 +58,7 @@ public function onChange($delta); * The item at the specified position in this list. An empty item is created * if it does not exist yet. * - * @throws \Drupal\Core\TypedData\MissingDataException + * @throws \Drupal\Core\TypedData\Exception\MissingDataException * If the complex data structure is unset and no item can be created. */ public function get($index); @@ -74,7 +74,7 @@ public function get($index); * @return static * Returns the list. * - * @throws \Drupal\Core\TypedData\MissingDataException + * @throws \Drupal\Core\TypedData\Exception\MissingDataException * If the complex data structure is unset and no item can be set. */ public function set($index, $item); @@ -85,7 +85,7 @@ public function set($index, $item); * @return \Drupal\Core\TypedData\TypedDataInterface * The first item in this list. * - * @throws \Drupal\Core\TypedData\MissingDataException + * @throws \Drupal\Core\TypedData\Exception\MissingDataException * If the complex data structure is unset and no item can be created. */ public function first(); diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 1dbd75b..f81f251 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -1133,4 +1133,5 @@ public function getListCacheTags() { public function getTypedData() { $this->storage->getTypedData(); } + }