.

DataObjectTimestampedCached Class Reference

Base class for items where creation and modification date is of interest. More...

Inheritance diagram for DataObjectTimestampedCached:
DataObjectCached ITimeStamped DataObjectBase IDataObject IActionSource ISearchAdapter IDBTable IDBWhereHolder

List of all members.

Public Member Functions

  get_creation_date ()
  Return creation date and time.
  get_modification_date ()
  Return modification date and time.
  insert ()
  Insert data.
  update ($policy=self::NORMAL)
  Update current item.

Public Attributes

  $creationdate
  $modificationdate

Protected Member Functions

  get_timestamp_field_declarations ()
  Returns array of field instances for ceration- and modificationdate.

Detailed Description

Base class for items where creation and modification date is of interest.

If used, just array_merge your table fields and $this->get_timestamp_field_declarations():

   ...,
   array_merge(array(
        new DBFieldInt('id', ...),
      .. more of your fields ...
      ), $this->get_timestamp_field_declarations()
   ),
   ... 
Since:
0.5.1
Author:
Gerd Riesselmann

Definition at line 22 of file dataobjecttimestampedcached.cls.php.


Member Function Documentation

DataObjectTimestampedCached::get_creation_date (  ) 

Return creation date and time.

Returns:
timestamp

Implements ITimeStamped.

Definition at line 69 of file dataobjecttimestampedcached.cls.php.

00069                                             {
00070                 return $this->creationdate;
00071         }
DataObjectTimestampedCached::get_modification_date (  ) 

Return modification date and time.

Returns:
timestamp

Implements ITimeStamped.

Definition at line 78 of file dataobjecttimestampedcached.cls.php.

00078                                                 {
00079                 return $this->modificationdate;
00080         }       
DataObjectTimestampedCached::get_timestamp_field_declarations (  )  [protected]

Returns array of field instances for ceration- and modificationdate.

Returns:
array

Definition at line 31 of file dataobjecttimestampedcached.cls.php.

00031                                                               {
00032                 return array(
00033                         new DBFieldDateTime('creationdate', DBFieldDateTime::NOW, DBFieldDateTime::NOT_NULL | DBField::INTERNAL),
00034                         new DBFieldDateTime('modificationdate', DBFieldDateTime::NOW, DBFieldDateTime::TIMESTAMP | DBFieldDateTime::NOT_NULL | DBField::INTERNAL),
00035                 );
00036         }
DataObjectTimestampedCached::insert (  ) 

Insert data.

Autoincrement IDs will be automatically set.

Returns:
Status

Reimplemented from DataObjectBase.

Definition at line 43 of file dataobjecttimestampedcached.cls.php.

00043                                  {
00044                 $this->modificationdate = time();
00045                 $this->creationdate = time();
00046                 return parent::insert();
00047         }
DataObjectTimestampedCached::update ( policy = self::NORMAL  ) 

Update current item.

Parameters:
int  $policy If DBDataObject::WHERE_ONLY is used, no conditions are build automatically
Returns:
Status

Reimplemented from DataObjectBase.

Definition at line 55 of file dataobjecttimestampedcached.cls.php.

00055                                                      {
00056                 $this->modificationdate = time();
00057                 return parent::update($policy); 
00058         }

Member Data Documentation

DataObjectTimestampedCached::$creationdate

Definition at line 23 of file dataobjecttimestampedcached.cls.php.

DataObjectTimestampedCached::$modificationdate

Definition at line 24 of file dataobjecttimestampedcached.cls.php.


The documentation for this class was generated from the following file: