Makes a Nos\Orm\Model sortable.
Required. Column name use for save sort index. Column must have type double.
ASC (default) ou DESC
True by default. If false and the model is twinnable, the sorting won’t be common to all contexts.
Parameters: |
|
---|
Parameters: |
|
---|
Moves the current item to the last position (of its siblings).
<?php
class Model_Page extends \Nos\Orm\Model
{
protected static $_behaviours = array(
'Nos\Orm_Behaviour_Sortable' => array(
'events' => array('after_sort', 'before_insert'),
'sort_property' => 'page_sort',
),
);
}
$page_1 = Model_Page::find(1);
$page_2 = Model_Page::find(2);
$page_2->move_after($page_1);