Completed
Branch master (3509e4)
by Pavel
04:33
created
Category
src/Sortable.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     }
60 60
 
61 61
     /** After update event */
62
-    public function afterUpdate(){
62
+    public function afterUpdate() {
63 63
         // TODO check that change conditions and recalculate old range, and move to top in new range
64 64
     }
65 65
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         }
109 109
         $owner = $this->owner;
110 110
         $condition = $this->_buildCondition();
111
-        $newSort = $owner->{$this->sortAttribute} + $value;
111
+        $newSort = $owner->{$this->sortAttribute} +$value;
112 112
         if ($value > 0) {
113 113
             // move up
114 114
             $max = $this->owner->find()->andWhere($condition)->count() - 1;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
                 [$this->sortAttribute => new Expression('(@sortingCount:=(@sortingCount+1))')],
159 159
                 $this->_buildCondition(),
160 160
                 $params
161
-            ) . ' ' . $builder->buildOrderBy($orderFields);
162
-        $db->createCommand('set @sortingCount=-1;' . $query, $params)->execute();
161
+            ).' '.$builder->buildOrderBy($orderFields);
162
+        $db->createCommand('set @sortingCount=-1;'.$query, $params)->execute();
163 163
         // update in current record
164 164
         $owner->{$this->sortAttribute} = $owner->findOne($owner->getPrimaryKey())->{$this->sortAttribute};
165 165
     }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     protected function _buildCondition()
172 172
     {
173 173
         $condition = ['and'];
174
-        foreach ((array)$this->conditionAttributes as $attribute) {
174
+        foreach ((array) $this->conditionAttributes as $attribute) {
175 175
             if ($this->owner->hasAttribute($attribute)) {
176 176
                 $condition[] = [$attribute => $this->owner->$attribute];
177 177
             }
Please login to merge, or discard this patch.