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);
}
doc_Drupal
2016-10-29 09:50:02
Comments
Leave a Comment

Please login to continue.