| @@ 35-74 (lines=40) @@ | ||
| 32 | * |
|
| 33 | * @mixin NestedSetsBehavior |
|
| 34 | */ |
|
| 35 | class MultipleTreeNode extends \yii\db\ActiveRecord |
|
| 36 | { |
|
| 37 | /** |
|
| 38 | * @inheritdoc |
|
| 39 | */ |
|
| 40 | public static function tableName() |
|
| 41 | { |
|
| 42 | return '{{%multiple_tree}}'; |
|
| 43 | } |
|
| 44 | /** |
|
| 45 | * @inheritdoc |
|
| 46 | */ |
|
| 47 | public function behaviors() |
|
| 48 | { |
|
| 49 | return [ |
|
| 50 | [ |
|
| 51 | 'class' => NestedSetsBehavior::className(), |
|
| 52 | 'treeAttribute' => 'tree', |
|
| 53 | ], |
|
| 54 | ]; |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * @inheritdoc |
|
| 59 | */ |
|
| 60 | public function transactions() |
|
| 61 | { |
|
| 62 | return [ |
|
| 63 | self::SCENARIO_DEFAULT => self::OP_ALL, |
|
| 64 | ]; |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * @return NodeQuery |
|
| 69 | */ |
|
| 70 | public static function find() |
|
| 71 | { |
|
| 72 | return new NodeQuery(get_called_class()); |
|
| 73 | } |
|
| 74 | } |
|
| @@ 34-72 (lines=39) @@ | ||
| 31 | * |
|
| 32 | * @mixin NestedSetsBehavior |
|
| 33 | */ |
|
| 34 | class Node extends \yii\db\ActiveRecord |
|
| 35 | { |
|
| 36 | /** |
|
| 37 | * @inheritdoc |
|
| 38 | */ |
|
| 39 | public static function tableName() |
|
| 40 | { |
|
| 41 | return '{{%tree}}'; |
|
| 42 | } |
|
| 43 | /** |
|
| 44 | * @inheritdoc |
|
| 45 | */ |
|
| 46 | public function behaviors() |
|
| 47 | { |
|
| 48 | return [ |
|
| 49 | [ |
|
| 50 | 'class' => NestedSetsBehavior::className(), |
|
| 51 | ], |
|
| 52 | ]; |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * @inheritdoc |
|
| 57 | */ |
|
| 58 | public function transactions() |
|
| 59 | { |
|
| 60 | return [ |
|
| 61 | self::SCENARIO_DEFAULT => self::OP_ALL, |
|
| 62 | ]; |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * @return NodeQuery |
|
| 67 | */ |
|
| 68 | public static function find() |
|
| 69 | { |
|
| 70 | return new NodeQuery(get_called_class()); |
|
| 71 | } |
|
| 72 | } |
|