Completed
Push — master ( 3509e4...df4deb )
by Pavel
03:03
created
src/SortableBehavior.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $currentCondition = [];
67 67
         /** @var ActiveRecord $owner */
68 68
         $owner = $this->owner;
69
-        foreach ((array)$this->conditionAttributes as $attribute) {
69
+        foreach ((array) $this->conditionAttributes as $attribute) {
70 70
             if (!$owner->hasAttribute($attribute)) {
71 71
                 continue;
72 72
             }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         }
133 133
         $owner = $this->owner;
134 134
         $condition = $this->_buildCondition();
135
-        $newSort = $owner->{$this->sortAttribute} + $value;
135
+        $newSort = $owner->{$this->sortAttribute} +$value;
136 136
         if ($value > 0) {
137 137
             // move up
138 138
             $max = $this->owner->find()->andWhere($condition)->count() - 1;
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
                 [$this->sortAttribute => new Expression('(@sortingCount:=(@sortingCount+1))')],
183 183
                 $this->_buildCondition(),
184 184
                 $params
185
-            ) . ' ' . $builder->buildOrderBy($orderFields);
186
-        $db->createCommand('set @sortingCount=-1;' . $query, $params)->execute();
185
+            ).' '.$builder->buildOrderBy($orderFields);
186
+        $db->createCommand('set @sortingCount=-1;'.$query, $params)->execute();
187 187
         // update in current record
188 188
         if (!$owner->getIsNewRecord()) {
189 189
             $owner->{$this->sortAttribute} = $owner->findOne($owner->getPrimaryKey())->{$this->sortAttribute};
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     protected function _buildCondition()
198 198
     {
199 199
         $condition = ['and'];
200
-        foreach ((array)$this->conditionAttributes as $attribute) {
200
+        foreach ((array) $this->conditionAttributes as $attribute) {
201 201
             if ($this->owner->hasAttribute($attribute)) {
202 202
                 $condition[] = [$attribute => $this->owner->$attribute];
203 203
             }
Please login to merge, or discard this patch.