You are here

public function DateObject::__sleep in Date 7

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

Helper function to prepare the object during serialization.

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

Ref: http://bugs.php.net/41334, http://bugs.php.net/39821

File

date_api/date_api.module, line 67
This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.

Class

DateObject
Extend PHP DateTime class with granularity handling, merge functionality and slightly more flexible initialization parameters.

Code

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