/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new CategoryTranslation(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['CategoryTranslation'])) { $model->attributes = $_POST['CategoryTranslation']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id_category_translation)); } } $this->render('create', array('model' => $model)); }
public function afterSave() { if ($this->isNewRecord) { $category_translation = new CategoryTranslation(); $category_translation->id_category = $this->id_category; $category_translation->name = $this->name; $category_translation->id_language = 1; $category_translation->save(); } }