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