Observer class to generate SEO friendly slugs from a model property (usually something like a title)

 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

Creates a slug (unique by default) and adds it to the object

before_insert(\Orm\Model $obj) 

Parameters

$obj

\Orm\Model

Model object subject of this observer method

Creates a new slug (unique by default) and update the object

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

$instance

\Orm\Model

$event

string

 Properties

 

<p>Required to be overwritten</p>

$overwrite : bool

 

<p>Default slug property</p>

$property : string

 

<p>Default separator</p>

$separator : string

 

<p>Default source property or array of properties, which is/are used to create the slug</p>

$source : mixed

 

<p>Required to be unique</p>

$unique : bool

 

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

$_instances : array
Inherited

inherited_from \Orm\Observer::$$_instances
 

<p>If the slug can be manually assigned</p>

$_overwrite : bool

 

<p>Slug property</p>

$_property : string

 

<p>Slug separator</p>

$_separator : string

 

<p>Source property or array of properties, which is/are used to create the slug</p>

$_source : mixed

 

<p>If the slug is required to be unique</p>

$_unique : bool