You are here

public function FieldCollectionItemEntity::__sleep in Field collection 7

Magic method to only serialize what's necessary.

Overrides Entity::__sleep

File

./field_collection.entity.inc, line 655

Class

FieldCollectionItemEntity
Class for field_collection_item entities.

Code

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

  // Also do not serialize the host entity, but only if it has already an id.
  if ($this->hostEntity && ($this->hostEntityId || $this->hostEntityRevisionId)) {
    unset($vars['hostEntity']);
  }

  // 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));
}