Contextable

class Nos\Orm_Behaviour_Contextable
Allows a Nos\Orm\Model to be bound to a context.

See also

Multi-Contexts.

Configuration

property Nos\Orm_Behaviour_Contextable::$context_property

Required. Column used to store the item’s context. Its data type must be varchar(25).

property Nos\Orm_Behaviour_Contextable::$default_context

Default context to use if not set when creating an item.

Methods

Nos\Orm_Behaviour_Contextable::get_context()
Returns:The item’s context.

Other

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.

Example

<?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',
                ),
        );
}
Read the Docs v: chiba.1
Versions
latest
chiba.2
chiba.1
0.2
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.