/** * Updates an existing Article 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); $dataModel = ArticleData::findOne($id); if ($model->load(Yii::$app->request->post()) && $dataModel->load(Yii::$app->request->post())) { $isValid = $model->validate(); $isValid = $dataModel->validate() && $isValid; if ($isValid) { $model->save(false); $dataModel->save(false); return $this->redirect(['index']); } } return $this->render('update', ['model' => $model, 'dataModel' => $dataModel]); }