Required. Column used to store the common ID between twinned items. Data type must be int.
Required. Column used to store if the item is the main item among twin items. Data type must be boolean.
Array of fields which are common to all context twins.
Returns: | True if model has common fields, medias or WYSIWYGs. |
---|
Parameters: |
|
---|---|
Returns: | True if the field name is a common field or, media or WYSIWYG. |
Removes all items twinned to the current item, including the current item itself.
Returns: | True if item is the main among twin items. |
---|
Parameters: |
|
---|---|
Returns: | A twinned item, or an array of twinned items, null or array() if none. |
Returns: | The main item among the twins. |
---|
Alias for ->find_context('main').
Parameters: |
|
---|---|
Returns: | Array of twin items, current item exclude. |
Returns: | Array of all twinned contexts, including the one of the current item. |
---|
Parameters: |
|
---|---|
Returns: | Array of all twinned contexts ID, excluding the one of the current item. |
Returns: | Array of possible contexts ID for current item. |
---|
Parameters: |
|
---|---|
Returns: | Array of items, like find(), either in the given context, either the main. |
See also
<?php
class Model_Page extends \Nos\Orm\Model
{
protected static $_behaviours = array(
'Nos\Orm_Behaviour_Twinnable' => array(
'events' => array('before_insert', 'after_insert', 'before_save', 'after_delete', 'change_parent'),
'context_property' => 'page_context',
'common_id_property' => 'page_context_common_id',
'is_main_property' => 'page_context_is_main',
'common_fields' => array(),
),
);
}