You are here

public function DateObject::__sleep in Date 7.2

Same name and namespace in other branches
  1. 7.3 date_api/date_api.module \DateObject::__sleep()
  2. 7 date_api/date_api.module \DateObject::__sleep()

Prepares the object during serialization.

We are extending a core class and core classes cannot be serialized.

Return value

array Returns an array with the names of the variables that were serialized.

See also

http://bugs.php.net/41334

http://bugs.php.net/39821

File

date_api/date_api.module, line 184
This module will make the date API available to other modules.

Class

DateObject
Extend PHP DateTime class.

Code

public function __sleep() {
  $this->serializedTime = $this
    ->format('c');
  $this->serializedTimezone = $this
    ->getTimezone()
    ->getName();
  return array(
    'serializedTime',
    'serializedTimezone',
  );
}