Commit 5528fa2f829f7110cff6139303dbd76baf6dae2c

Authored by alex
1 parent cd68a3a3

Убрал behavior с сорта. Теперь можно просто изменять значение поля sort

backend/controllers/DoctorController.php
... ... @@ -156,7 +156,8 @@
156 156 'hasAlias' => true,
157 157  
158 158 'languageFields' => [
159   - [
  159 +
  160 + [
160 161 'name' => 'name',
161 162 'type' => Form::STRING,
162 163 'decorate' => true
... ... @@ -171,6 +172,10 @@
171 172 ],
172 173 ],
173 174 'fields' => [
  175 + [
  176 + 'name' => 'sort',
  177 + 'type' => Form::NUMBER,
  178 + ],
174 179 [
175 180 'name' => 'image_id',
176 181 'type' => Form::IMAGE
... ... @@ -186,10 +191,7 @@
186 191 'name' => 'status',
187 192 'type' => Form::BOOL,
188 193 ],
189   - [
190   - 'name' => 'sort',
191   - 'type' => Form::NUMBER,
192   - ],
  194 +
193 195 ],
194 196 ];
195 197 }
... ...
common/models/Doctor.php
... ... @@ -55,10 +55,10 @@ class Doctor extends \yii\db\ActiveRecord
55 55 );
56 56 },
57 57 ],
58   - 'positionBehavior' => [
59   - 'class' => PositionBehavior::className(),
60   - 'positionAttribute' => 'sort',
61   - ],
  58 +// 'positionBehavior' => [
  59 +// 'class' => PositionBehavior::className(),
  60 +// 'positionAttribute' => 'sort',
  61 +// ],
62 62 ];
63 63 }
64 64 /**
... ...
frontend/controllers/SiteController.php
... ... @@ -294,6 +294,10 @@
294 294 {
295 295 $doctors = Doctor::find()
296 296 ->where(['status' => true])
  297 + ->orderBy([
  298 + 'sort' => SORT_ASC,
  299 + 'id' => SORT_ASC
  300 + ])
297 301 ->all();
298 302  
299 303 return $this->render('doctor',
... ...