public function Entity::__sleep in Entity API 7
Magic method to only serialize what's necessary.
File
- includes/
entity.inc, line 402 - Provides a base class for entities.
Class
- Entity
- A common class for entities.
Code
public function __sleep() {
$vars = get_object_vars($this);
unset($vars['entityInfo'], $vars['idKey'], $vars['nameKey'], $vars['statusKey']);
// 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));
}