CreatedAt observer.

Makes sure the created timestamp column in a Model record gets a value when a new record is inserted 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 CreatedAt property to the current time.

before_insert(\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

$instance

\Orm\Model

$event

string

 Properties

 

<p>default setting, true to use mySQL timestamp instead of UNIX timestamp</p>

$mysql_timestamp : bool

 

<p>default 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>whether to overwrite an already set timestamp</p>

$_overwrite : string

 

<p>property to set the timestamp on</p>

$_property : string