@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Created by PhpStorm. |
|
4 | - * User: vadim |
|
5 | - * Date: 22.01.15 |
|
6 | - * Time: 13:47 |
|
7 | - */ |
|
3 | + * Created by PhpStorm. |
|
4 | + * User: vadim |
|
5 | + * Date: 22.01.15 |
|
6 | + * Time: 13:47 |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | namespace sibds\components; |
10 | 10 |
@@ -101,20 +101,20 @@ |
||
101 | 101 | ]; |
102 | 102 | } |
103 | 103 | |
104 | - if($this->isNestedSet()){ |
|
104 | + if ($this->isNestedSet()) { |
|
105 | 105 | $behaviors['tree'] = ArrayHelper::merge([ |
106 | 106 | 'class' => \creocoder\nestedsets\NestedSetsBehavior::className(), |
107 | 107 | 'leftAttribute' => 'lft', |
108 | 108 | 'rightAttribute' => 'rgt', |
109 | 109 | 'depthAttribute' => 'depth', |
110 | - ], ($this->hasAttribute('tree')?['treeAttribute' => 'tree']:[])); |
|
110 | + ], ($this->hasAttribute('tree') ? ['treeAttribute' => 'tree'] : [])); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $behaviors; |
114 | 114 | } |
115 | 115 | |
116 | - public function isNestedSet(){ |
|
117 | - return $this->hasAttribute('lft')&&$this->hasAttribute('rgt')&&$this->hasAttribute('depth'); |
|
116 | + public function isNestedSet() { |
|
117 | + return $this->hasAttribute('lft') && $this->hasAttribute('rgt') && $this->hasAttribute('depth'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -19,11 +19,12 @@ |
||
19 | 19 | } |
20 | 20 | } |
21 | 21 | |
22 | - if ($obj->hasAttribute($obj->removedAttribute)) |
|
23 | - return (new DynamicQuery($obj))->findRemoved()->andFilterWhere($condition); |
|
24 | - elseif ($obj->isNestedSet()) |
|
25 | - return (new DynamicQuery($obj))->andFilterWhere($condition); |
|
26 | - else |
|
27 | - return parent::find()->andFilterWhere($condition); |
|
22 | + if ($obj->hasAttribute($obj->removedAttribute)) { |
|
23 | + return (new DynamicQuery($obj))->findRemoved()->andFilterWhere($condition); |
|
24 | + } elseif ($obj->isNestedSet()) { |
|
25 | + return (new DynamicQuery($obj))->andFilterWhere($condition); |
|
26 | + } else { |
|
27 | + return parent::find()->andFilterWhere($condition); |
|
28 | + } |
|
28 | 29 | } |
29 | 30 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Created by PhpStorm. |
|
4 | - * User: vadim |
|
5 | - * Date: 07.03.16 |
|
6 | - * Time: 2:11 |
|
7 | - */ |
|
3 | + * Created by PhpStorm. |
|
4 | + * User: vadim |
|
5 | + * Date: 07.03.16 |
|
6 | + * Time: 2:11 |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | namespace sibds\components; |
10 | 10 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $behaviors[] = TrashQueryBehavior::className(); |
27 | 27 | } |
28 | 28 | |
29 | - if($model->hasAttribute('lft')&&$model->hasAttribute('rgt')&&$model->hasAttribute('depth')){ |
|
29 | + if ($model->hasAttribute('lft') && $model->hasAttribute('rgt') && $model->hasAttribute('depth')) { |
|
30 | 30 | $behaviors[] = NestedSetsQueryBehavior::className(); |
31 | 31 | } |
32 | 32 |