You are here

public function ParagraphsItemEntity::__sleep in Paragraphs 7

Magic method to only serialize what's necessary.

Overrides Entity::__sleep

File

./ParagraphsItemEntity.inc, line 530

Class

ParagraphsItemEntity
Entity implementation for the paragraphs entity.

Code

public function __sleep() {
  $vars = get_object_vars($this);
  unset($vars['entityInfo'], $vars['idKey'], $vars['nameKey'], $vars['statusKey']);
  unset($vars['fieldInfo']);

  // Also do not serialize the host entity.
  // We add our hostEntity in code.
  unset($vars['hostEntity']);

  // We unset our host entity, we have to let our object know.
  unset($vars['fetchedHostEntityDetails']);

  // Also key the returned array with the variable names so the method may
  // be easily overridden and customized.
  return drupal_map_assoc(array_keys($vars));
}