UpdatedAt observer.
Makes sure the updated timestamp column in a Model record
gets a value when a record is updated in the database.
Methods
Set the properties for this observer instance, based on the parent model's
configuration or the defined defaults.
__construct(string $class)
Parameters
$class
string
Model class this observer is called on
Set the UpdatedAt property to the current time.
before_save(\Orm\Model $obj)
Parameters
$obj
\Orm\Model
Model object subject of this observer method
Set the UpdatedAt property to the current time.
before_update(\Orm\Model $obj)
Parameters
$obj
\Orm\Model
Model object subject of this observer method
Create an instance of this observer
instance(string $model_class)
Inherited
inherited_from |
\Orm\Observer::instance() |
Parameters
$model_class
string
name of the model class
Get notified of an event
orm_notify(\Orm\Model $instance, string $event)
Inherited
inherited_from |
\Orm\Observer::orm_notify() |
Parameters
$event
string
Checks to see if any models in the given relation are changed.
relation_changed(\Orm\Model $obj, string $relation) : bool
This function is lazy so will return true as soon
as it finds something that has changed.
Parameters
$relation
string
Returns
bool
Properties
<p>set true to use mySQL timestamp instead of UNIX timestamp</p>
$mysql_timestamp : bool
<p>property to set the timestamp on</p>
$property : string
<p>list of created observer instances created</p>
$_instances : array
Inherited
inherited_from |
\Orm\Observer::$$_instances |
<p>true to use mySQL timestamp instead of UNIX timestamp</p>
$_mysql_timestamp : bool
<p>property to set the timestamp on</p>
$_property : string
<p>Names of any relations that should be taken into account when checking if the model has been updated</p>
$_relations : array