/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate() { if (!empty($_POST["CatComments"])) { if ($this->id > 0) { $model = CatComments::fetch($this->id); } else { $model = new CatComments(); } $catalogClass = SiteHelper::getCamelCase($model->catalog); $catalogItemModel = $catalogClass::fetch($model->item_id); $message = ""; // Сохрание полей $model->setAttributesFromArray($_POST["CatComments"]); if ($model->save()) { $message = "Данные успешно сохраненны"; } else { print_r($model->getErrors()); } $this->render('edit', array('form' => $model, 'message' => $message, "catalogItemModel" => $catalogItemModel)); } //else $this->redirect( SiteHelper::createUrl("/console/comments") ); }