? $this->findModel(Yii::$app->request->post()['CityStoreParams']['id'])
: new CityStoreParams();
-
if ($model->load(Yii::$app->request->post())) {
$model->matrix_type = is_array($model->matrix_type) ? implode(',', $model->matrix_type) : $model->matrix_type;
-// $oldStoreDynamic = StoreDynamic::findOne(['store_id' => $model->store_id, 'category' => 1, 'active' => 1]) ?? null;
-// if ($oldStoreDynamic != $model->bush_id) {
-// $newStoreDynamic = new StoreDynamic();
-// $newStoreDynamic->setAttributes([
-// 'store_id' => $model->store_id,
-// 'value_type' => 'int',
-// 'value_int' => $model->bush_id,
-// 'date_from' => new Expression('now()'),
-// 'date_to' => '2100-01-01 00:00:00',
-// 'active' => 1,
-// 'category' => 1
-// ]);
-// $oldStoreDynamic->update(['date_to' => new Expression('now()'), 'active' => 0], ['store_id' => $model->store_id, 'category' => 1, 'active' => 1]);
-// }
-//
-//// $oldBushChefFlorist =
-
- if ($model->validate()) {
- $model->save();
- return $this->redirect(['view', 'id' => $model->id]);
- }
+ }
+
+ if ($model->validate()) {
+ $model->save();
+ return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('index');
public function getAddressCity() {
return $this->hasOne(StoreCityList::class, ['id' => 'address_city']);
}
+
+ public function getBush() {
+ return $this->hasOne(ClusterAdmin::class, ['id' => 'bush_id']);
+ }
}
return $data->territorialManager->name_full ?? '';
}
],
+ [
+ 'attribute' => 'bushId',
+ 'value' => function ($data) {
+ return $data->bush->name ?? '';
+ }
+ ],
[
'attribute' => 'bush_chef_florist',
'value' => function ($data) {