Nos\
Orm_Behaviour_Contextable
¶Allows aNos\Orm\Model
to be bound to a context.
See also
Nos\Orm_Behaviour_Contextable::$
context_property
¶Required.
Column used to store the item’s context. Its data type must be varchar(25)
.
Nos\Orm_Behaviour_Contextable::$
default_context
¶Default context to use if not set when creating an item.
This behaviour extends Model->find().
Add option to where
array passed to method: you can use the context
key as an alias to search in the column
Orm_Behaviour_Contextable::$context_property
.
<?php
class Model_Page extends \Nos\Orm\Model
{
protected static $_behaviours = array(
'Nos\Orm_Behaviour_Contextable' => array(
'events' => array('before_insert'),
'context_property' => 'form_context',
),
);
}