Observer class to validate the properties of the model before save.

It is also used in Fieldset generation based on a model, to populate the fields and field validation rules of the Fieldset.

 Methods

Execute before inserting the row in the database

before_insert(\Orm\Model $obj) 

Parameters

$obj

\Orm\Model

the model object to validate

Exceptions

\Orm\ValidationFailed

Execute before saving the Model

before_save(\Orm\Model $obj) 

Parameters

$obj

\Orm\Model

the model object to validate

Exceptions

\Orm\ValidationFailed

Execute before updating the row in the database

before_update(\Orm\Model $obj) 

Parameters

$obj

\Orm\Model

the model object to validate

Exceptions

\Orm\ValidationFailed

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

Set a Model's properties as fields on a Fieldset, which will be created with the Model's classname if none is provided.

set_fields($obj, $fieldset) : \Fieldset

Parameters

$obj

string

$fieldset

\Fieldset|null

Returns

\Fieldset

Validate the model

validate(\Orm\Model $obj) 

Parameters

$obj

\Orm\Model

the model object to validate

Exceptions

\Orm\ValidationFailed

 Properties

 

<p>list of created observer instances created</p>

$_instances : array
Inherited

inherited_from \Orm\Observer::$$_instances