smukm / sortorder_behavior
Behavior for automatic filling sorting field for Yii2 AR Models
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Open Issues: 0
Type:yii2-extension
Requires
- php: >=8.0
- yiisoft/yii2: *
Requires (Dev)
- phpunit/phpunit: ~4.0
README
Behavior for automatic filling sorting field for Yii2 AR Models
Install via Composer:
composer require smukm/sortorder
Configuring
use smukm\sortorder; class Sample extends \yii\db\ActiveRecord { public function behaviors() { return [ 'SortOrderBehavior' => [ 'class' => SortOrderBehavior::class, 'sortAttribute' => 'order', ] ]; } }
Options
sortAttribute = 'order'
- name of the sorting fieldgroupAttribute = 'some_group'
- sorting within a groupincrementValue = 10
- increment value