diff --git a/core/modules/field/src/Entity/FieldInstanceConfig.php b/core/modules/field/src/Entity/FieldInstanceConfig.php index 8ce7afa..2b8fac0 100644 --- a/core/modules/field/src/Entity/FieldInstanceConfig.php +++ b/core/modules/field/src/Entity/FieldInstanceConfig.php @@ -617,7 +617,7 @@ public function targetBundle() { return $this->bundle; } - /* + /** * Implements the magic __sleep() method. * * Using the Serialize interface and serialize() / unserialize() methods @@ -625,20 +625,11 @@ public function targetBundle() { * @todo Investigate in https://drupal.org/node/2074253. */ public function __sleep() { - // Only serialize properties from self::toArray(). - $properties = array_keys(array_intersect_key($this->toArray(), get_object_vars($this))); - // Serialize $entityTypeId property so that toArray() works when waking up. - $properties[] = 'entityTypeId'; - return $properties; - } - - /** - * Implements the magic __wakeup() method. - */ - public function __wakeup() { - // Run the values from self::toArray() through __construct(). - $values = array_intersect_key($this->toArray(), get_object_vars($this)); - $this->__construct($values); + // Only serialize necessary properties, excluding those that can be + // recalculated. + $properties = get_object_vars($this); + unset($properties['fieldStorage'], $properties['itemDefinition'], $properties['bundle_rename_allowed']); + return array_keys($properties); } /** diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php index dcae40b..2c0e60b 100644 --- a/core/modules/field/src/Entity/FieldStorageConfig.php +++ b/core/modules/field/src/Entity/FieldStorageConfig.php @@ -642,20 +642,11 @@ public function hasData() { * @todo Investigate in https://drupal.org/node/2074253. */ public function __sleep() { - // Only serialize properties from self::toArray(). - $properties = array_keys(array_intersect_key($this->toArray(), get_object_vars($this))); - // Serialize $entityTypeId property so that toArray() works when waking up. - $properties[] = 'entityTypeId'; - return $properties; - } - - /** - * Implements the magic __wakeup() method. - */ - public function __wakeup() { - // Run the values from self::toArray() through __construct(). - $values = array_intersect_key($this->toArray(), get_object_vars($this)); - $this->__construct($values); + // Only serialize necessary properties, excluding those that can be + // recalculated. + $properties = get_object_vars($this); + unset($properties['schema'], $properties['propertyDefinitions']); + return array_keys($properties); } /**