Sortable
        
        Sortable model behavior
    
    
 class Winter\Storm\Database\Behaviors\Sortable
extends Winter\Storm\Extension\ExtensionBaseUsage:
Model table must have sort_order table column.
In the model class definition:
public $implement = [ \Winter\Storm\Database\Behaviors\Sortable::class, ];
To set orders:
$model->setSortableOrder($recordIds, $recordOrders);
You can change the sort field used by declaring this in your model:
const SORT_ORDER = 'my_sort_order';
Extends
| Class | Description | 
|---|---|
| ExtensionBase | Extension class Allows for "Private traits" | 
Traits
| Trait | Description | 
|---|---|
| ExtensionTrait | Extension trait | 
Properties
protected $model : mixed
            
                            
                    inherited
                
            
            
                public
            
                            
                    static
                
            
            $extendableStaticCalledClass
            
                :
                                                            string
                                                                        
                        = null
                    
                            
        
                    The calling class when using a static method.
            
                            
                    inherited
                
            
            
                protected
            
                            
                    static
                
            
            $extensionCallbacks
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
                    Used to extend the constructor of an extension class. Eg:
BehaviorClass::extend(function($obj) { })
            
                            
                    inherited
                
            
            
                protected
            
            
            $extensionHidden
            
                :
                                                            mixed
                                                                        
                        = {"fields":[],"methods":["extensionIsHiddenField","extensionIsHiddenMethod"]}
                    
                            
        
                    Methods
public __construct ($parent)
| Property | Type | Description | 
|---|---|---|
| $parent | mixed | mixed | 
public bootSortable () : void
Boot the sortable behavior for this model.
public getSortOrderColumn () : string
Get the name of the "sort order" column.
            
            
            
                public
            
                        
            setSortableOrder (mixed $itemIds, array $itemOrders = null)
                            : void
                    
        
        Sets the sort order of records to the specified orders. If the orders is undefined, the record identifier is used.
| Property | Type | Description | 
|---|---|---|
| $itemIds | mixed | mixed | 
| $itemOrders | array | array | 
inherited public static extend (callable $callback)
| Property | Type | Description | 
|---|---|---|
| $callback | callable | callable | 
inherited public extensionApplyInitCallbacks ()
inherited public static extensionExtendCallback (callable $callback) : void
Helper method for ::extend() static method
| Property | Type | Description | 
|---|---|---|
| $callback | callable | callable | 
inherited public extensionIsHiddenField ($name)
| Property | Type | Description | 
|---|---|---|
| $name | mixed | mixed | 
inherited public extensionIsHiddenMethod ($name)
| Property | Type | Description | 
|---|---|---|
| $name | mixed | mixed | 
inherited public static getCalledExtensionClass ()
inherited protected extensionHideField ($name)
| Property | Type | Description | 
|---|---|---|
| $name | mixed | mixed | 
inherited protected extensionHideMethod ($name)
| Property | Type | Description | 
|---|---|---|
| $name | mixed | mixed |