modules/admin/controllers/ProductRatingController.php
/**
     * Updates an existing ProductRating model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     * @throws NotFoundHttpException if the model cannot be found
     */
Updates an existing ProductRating model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
@throws NotFoundHttpException if the model cannot be found
Updates an existing ProductRating model . If update is successful the browser will be redirected to the ' view ' page . @param integer $id @return mixed @throws NotFoundHttpException if the model cannot be found
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        $product_id = $model->product_id;
        $user_id = $model->user_id;
        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
            $model->user_id = $user_id;
            $model->product_id = $product_id;
            if(!empty(Yii::$app->request->post('ProductRating')['status'])){
                $model->status = Yii::$app->request->post('ProductRating')['status'];
            }
            if ($model->save()) {
                \Yii::$app->getSession()->setFlash(Growl::TYPE_SUCCESS, 'Product Rating updated successfully.');
            } else {
                Yii::$app->session->setFlash(Growl::TYPE_DANGER, "Error while updating Product Rating.");
            }
            return $this->redirect(['index']);
        }
        return $this->render('update', [
            'model' => $model,
        ]);
    }
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ product_id = $ model -> product_id ; $ user_id = $ model -> user_id ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> validate ( ) ) { $ model -> user_id = $ user_id ; $ model -> product_id = $ product_id ; if ( ! empty ( Yii :: $ app -> request -> post ( 'ProductRating' ) [ 'status' ] ) ) { $ model -> status = Yii :: $ app -> request -> post ( 'ProductRating' ) [ 'status' ] ; } if ( $ model -> save ( ) ) { \ Yii :: $ app -> getSession ( ) -> setFlash ( Growl :: TYPE_SUCCESS , 'Product Rating updated successfully.' ) ; } else { Yii :: $ app -> session -> setFlash ( Growl :: TYPE_DANGER , " Error while updating Product Rating. " ) ; } return $ this -> redirect ( [ 'index' ] ) ; } return $ this -> render ( 'update' , [ 'model' => $ model , ] ) ; }
Updates an existing ProductRating model.
Updates an existing ProductRating model .