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