diff --git a/src/Entity/FieldableEdgeEntityBase.php b/src/Entity/FieldableEdgeEntityBase.php index eb7801213..0a0a391a4 100644 --- a/src/Entity/FieldableEdgeEntityBase.php +++ b/src/Entity/FieldableEdgeEntityBase.php @@ -569,8 +569,7 @@ public function &__get($name) { if (!isset($this->fieldDefinitions)) { $this->getFieldDefinitions(); } - // Apigee base fields are special, so they need special treatment. - if (isset($this->fieldDefinitions[$name]) && !($this->fieldDefinitions[$name] instanceof BaseFieldDefinition)) { + if (isset($this->fieldDefinitions[$name])) { $return = $this->getField($name); return $return; } @@ -607,6 +606,11 @@ public function __set($name, $value) { $this->getField($name)->setValue($value); } } + // The translations array is unset when cloning the entity object, we just + // need to restore it. + elseif ($name == 'translations') { + $this->translations = $value; + } // Directly write non-field values. else { $this->values[$name] = $value; @@ -636,6 +640,17 @@ public function __unset($name) { } } + /** + * An array of entity translation metadata. + * + * An associative array keyed by translation language code. Every value is an + * array containing the translation status and the translation object, if it has + * already been instantiated. + * + * @var array + */ + private $translations = []; + /** * Gets a non-translatable field. *