From f3137bc12af58e4b50457d73a2d377ae44e74080 Mon Sep 17 00:00:00 2001 From: vova Date: Fri, 13 May 2022 17:38:21 +0300 Subject: [PATCH] product fix --- backend/controllers/ProductController.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+), 0 deletions(-) diff --git a/backend/controllers/ProductController.php b/backend/controllers/ProductController.php index 8961388..9d3580f 100644 --- a/backend/controllers/ProductController.php +++ b/backend/controllers/ProductController.php @@ -11,6 +11,34 @@ use yii\web\NotFoundHttpException; class ProductController extends Controller { /** + * Updates an existing Product model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + $model->generateLangs(); + + if ($model->loadWithLangs(\Yii::$app->request)) { + + if ($model->saveWithLangs()) { + + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } + } + return $this->render('update', [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ]); + } + /** * Lists all Tile models. * @return mixed */ -- libgit2 0.21.4