
Provides additional date/time functionality for fActiveRecord classes
1.0.0b9 | Updated code to work with the new fORM API 8/6/10 |
---|---|
1.0.0b8 | Changed validation messages array to use column name keys 5/26/10 |
1.0.0b7 | Fixed the set methods to return the record object in order to be consistent with all other set methods 3/15/10 |
1.0.0b6 | Fixed an issue with calling a non-existent method on fTimestamp instances 11/3/09 |
1.0.0b5 | Updated code for the new fORMDatabase and fORMSchema APIs 10/28/09 |
1.0.0b4 | Fixed setting up the inspect callback in configureTimezoneColumn() 10/11/09 |
1.0.0b3 | Updated to use new fORM::registerInspectCallback() method 7/13/09 |
1.0.0b2 | Updated code to use new fValidationException::formatField() method 6/4/09 |
1.0.0b | The initial implementation 9/5/08 |
Sets a column to be a date created column
When a new record is stored in the database, date created columns will be filled with the timestamp of the store operation.
void configureDateCreatedColumn( mixed $class, string $column )
mixed | $class | The class name or instance of the class |
string | $column | The column to set as a date created column |
Sets a column to be a date updated column
Whenever a record is stored in the database, a date updated column will be set to the timestamp of the operation.
void configureDateUpdatedColumn( mixed $class, string $column )
mixed | $class | The class name or instance of the class |
string | $column | The column to set as a date updated column |
Sets a timestamp column to store the timezone in another column
Since not all databases support timezone information in timestamp columns, this method allows storing the timezone in another columns. When the timestamp and timezone are retrieved from the database, they will be automatically combined together into an fTimestamp object.
void configureTimezoneColumn( mixed $class, string $timestamp_column, string $timezone_column )
mixed | $class | The class name or instance of the class to set the column format |
string | $timestamp_column | The timestamp column to store the timezone for |
string | $timezone_column | The column to store the timezone in |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Adds metadata about features added by this class
void inspect( string $class, string $column, array &$metadata )
string | $class | The class being inspected |
string | $column | The column being inspected |
array | &$metadata | The array of metadata about a column |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Creates fTimestamp objects for every timestamp/timezone combination in the object
void makeTimestampObjects( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Turns a timestamp value into an fTimestamp object with a timezone specified by another column
void objectifyTimestampWithTimezone( array &$values, array &$old_values, string $timestamp_column, string $timezone_column )
array | &$values | The current values |
array | &$old_values | The old values |
string | $timestamp_column | The column holding the timestamp |
string | $timezone_column | The column holding the timezone |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Resets the configuration of the class
void reset( )
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the appropriate column values to the date the object was created (for new records)
void setDateCreated( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the appropriate column values to the date the object was updated
void setDateUpdated( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the timestamp column and then tries to objectify it with an related timezone column
fActiveRecord setTimestampColumn( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $parameters )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
string | $method_name | The method that was called |
array | $parameters | The parameters passed to the method |
The record object, to allow for method chaining
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Sets the timezone column and then tries to objectify the related timestamp column
fActiveRecord setTimezoneColumn( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $parameters )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
string | $method_name | The method that was called |
array | $parameters | The parameters passed to the method |
The record object, to allow for method chaining
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Validates all timestamp/timezone columns
void validateTimezoneColumns( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, array &$validation_messages )
fActiveRecord | $object | The fActiveRecord instance |
array | &$values | The current values |
array | &$old_values | The old values |
array | &$related_records | Any records related to this record |
array | &$cache | The cache array for the record |
array | &$validation_messages | An array of ordered validation messages |