public function EntityDisplayBase::__sleep

public EntityDisplayBase::__sleep()

Overrides ConfigEntityBase::__sleep

File

core/lib/Drupal/Core/Entity/EntityDisplayBase.php, line 510

Class

EntityDisplayBase
Provides a common base class for entity view and form displays.

Namespace

Drupal\Core\Entity

Code

public function __sleep() {
  // Only store the definition, not external objects or derived data.
  $keys = array_keys($this->toArray());
  // In addition, we need to keep the entity type and the "is new" status.
  $keys[] = 'entityTypeId';
  $keys[] = 'enforceIsNew';
  // Keep track of the serialized keys, to avoid calling toArray() again in
  // __wakeup(). Because of the way __sleep() works, the data has to be
  // present in the object to be included in the serialized values.
  $keys[] = '_serializedKeys';
  $this->_serializedKeys = $keys;
  return $keys;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityDisplayBase.php/function/EntityDisplayBase::__sleep/8.1.x