W3cubDocs

/Drupal 8

public function TypedData::__sleep

public TypedData::__sleep()

File

core/lib/Drupal/Core/TypedData/TypedData.php, line 201

Class

TypedData
The abstract base class for typed data.

Namespace

Drupal\Core\TypedData

Code

public function __sleep() {
  $vars = get_object_vars($this);
  // Prevent services from being serialized. static::getStringTranslation()
  // and static::getTypedDataManager() lazy-load them after $this has been
  // unserialized.
  // @todo Replace this with
  //   \Drupal\Core\DependencyInjection\DependencySerializationTrait before
  //   Drupal 9.0.0. We cannot use that now, because child classes already use
  //   it and PHP 5 would consider that conflicts.
  unset($vars['stringTranslation']);
  unset($vars['typedDataManager']);

  return array_keys($vars);
}

© 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!TypedData!TypedData.php/function/TypedData::__sleep/8.1.x