If Orm_Behaviour_Virtualname::$unique is set, ->save() method can throw an Exception if slug already in use.
Required. Column used to store the slug.
true, false or 'context' if uniqueness must be checked by context.
Getter and setter for the virtual_name. Setter if a $slug is passed in parameters.
When use as setter, the new virtual name is transform to friendly slug.
Parameters: |
|
---|---|
Returns: | The item slug. |
Parameters: |
|
---|---|
Returns: | A clean slug, lowercase, without forbidden characters. |
<?php
class Model_Monkey extends \Nos\Orm\Model
{
protected static $_behaviours = array(
'Nos\Orm_Behaviour_Virtualname' => array(
'events' => array('before_save', 'after_save'),
'virtual_name_property' => 'monk_virtual_name',
),
);
}