PersistentObject: ezcPersistentPropertyDateTimeConverter
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcPersistentPropertyDateTimeConverter
|
Property converter class for date/time values. [
source]
Implemented Interfaces
Method Summary
Methods
fromDatabase
DateTime|null fromDatabase(
int|null
$databaseValue )
Converts unix timestamp to DateTime instance.
This method is called right after a column value has been read from the database, given the $databaseValue. The value returned by this method is then assigned to the persistent objects property.
The given integer value $databaseValue is handled as a date/time value in unix timestamp representation. A corresponding DateTime object is returned, representing the same date/time value.
Parameters
| Name |
Type |
Description |
$databaseValue |
int|null |
|
Throws
| Class | Description |
ezcBaseValueException |
if the given $databaseValue is not an integer. |
toDatabase
int|null toDatabase(
DateTime|null
$propertyValue )
Converts a DateTime object into a unix timestamp.
This method is called right before a property value is written to the database, given the $propertyValue. The value returned by this method is then written back to the database.
The method expects a DateTime object in $propertyValue and returns the date/time value represented by it as an integer value in unix timestamp format.
Parameters
| Name |
Type |
Description |
$propertyValue |
DateTime|null |
|
Throws
| Class | Description |
ezcBaseValueException |
if the given $propertyValue is not an instance of DateTime. |
__set_state
Method for de-serialization after var_export().
This methid must be implemented to allow proper de-serialization of converter objects, when they are exported using
http://www.php.net/var_export.
Parameters
| Name |
Type |
Description |
$state |
array |
|
Last updated: Mon, 10 Nov 2008