@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $currentCondition = []; |
78 | 78 | /** @var ActiveRecord $owner */ |
79 | 79 | $owner = $this->owner; |
80 | - foreach ((array)$this->conditionAttributes as $attribute) { |
|
80 | + foreach ((array) $this->conditionAttributes as $attribute) { |
|
81 | 81 | if (!$owner->hasAttribute($attribute)) { |
82 | 82 | continue; |
83 | 83 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | $owner = $this->owner; |
145 | 145 | $condition = $this->getCondition(); |
146 | - $newSort = $owner->{$this->sortAttribute} + $value; |
|
146 | + $newSort = $owner->{$this->sortAttribute} +$value; |
|
147 | 147 | if ($value > 0) { |
148 | 148 | // move up |
149 | 149 | $max = $this->getMaxSort(); |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | [$this->sortAttribute => new Expression('(@sortingCount:=(@sortingCount+1))')], |
194 | 194 | $this->getCondition(), |
195 | 195 | $params |
196 | - ) . ' ' . $builder->buildOrderBy($orderFields); |
|
197 | - $db->createCommand('set @sortingCount=-1;' . $query, $params)->execute(); |
|
196 | + ).' '.$builder->buildOrderBy($orderFields); |
|
197 | + $db->createCommand('set @sortingCount=-1;'.$query, $params)->execute(); |
|
198 | 198 | // update in current record |
199 | 199 | if (!$owner->getIsNewRecord()) { |
200 | 200 | $owner->{$this->sortAttribute} = $owner->findOne($owner->getPrimaryKey())->{$this->sortAttribute}; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | if ($this->_condition === null) { |
222 | 222 | $this->_condition = ['and']; |
223 | - foreach ((array)$this->conditionAttributes as $attribute) { |
|
223 | + foreach ((array) $this->conditionAttributes as $attribute) { |
|
224 | 224 | if ($this->owner->hasAttribute($attribute)) { |
225 | 225 | $this->_condition[] = [$attribute => $this->owner->$attribute]; |
226 | 226 | } |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | Yii::$app->response->format = Response::FORMAT_JSON; |
53 | 53 | } |
54 | 54 | if (empty($this->modelClass) || !class_exists($this->modelClass)) { |
55 | - throw new InvalidParamException('Define model class name for action ' . $this->controller->id . '::' . $this->id); |
|
55 | + throw new InvalidParamException('Define model class name for action '.$this->controller->id.'::'.$this->id); |
|
56 | 56 | } |
57 | 57 | /** @var ActiveRecord $class */ |
58 | 58 | $class = $this->modelClass; |
59 | 59 | /** @var SortableBehavior|ActiveRecord $model */ |
60 | 60 | $model = $class::findOne($id); |
61 | 61 | if (!$model) { |
62 | - throw new HttpException(404, 'Model `' . $this->modelClass . '` to change sort not found'); |
|
62 | + throw new HttpException(404, 'Model `'.$this->modelClass.'` to change sort not found'); |
|
63 | 63 | } |
64 | 64 | switch ($position) { |
65 | 65 | case 'top': |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | default: |
74 | 74 | if (strpos('ud-', $position[0]) !== false) { |
75 | 75 | // relative position |
76 | - $position = ($position[0] == 'd' ? '-' : '') . substr($position, 1); |
|
76 | + $position = ($position[0] == 'd' ? '-' : '').substr($position, 1); |
|
77 | 77 | if (is_numeric($position)) { |
78 | 78 | $model->sortChange($position); |
79 | 79 | } |