Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2. namespace frontend\models;
  3.  
  4. use common\models\Category;
  5. use creocoder\nestedsets\NestedSetsBehavior;
  6. use yii\db\ActiveRecord;
  7.  
  8. class Menu extends ActiveRecord
  9. {
  10.  
  11.     public function behaviors()
  12.     {
  13.         return [
  14.             'tree' => [
  15.                 'class' => NestedSetsBehavior::className(),
  16.                  'treeAttribute' => 'tree',
  17.                  'leftAttribute' => 'lft',
  18.                  'rightAttribute' => 'rgt',
  19.                  'depthAttribute' => 'depth',
  20.             ],
  21.         ];
  22.     }
  23.  
  24.     public function transactions()
  25.     {
  26.         return [
  27.             self::SCENARIO_DEFAULT => self::OP_ALL,
  28.         ];
  29.     }
  30.  
  31.     public static function find()
  32.     {
  33.         return new MenuQuery(get_called_class());
  34.     }
  35.  
  36.    
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement