/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { try { $model = new TestCase(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['TestCase'])) { $model->attributes = $_POST['TestCase']; //salvando a relacao com a tabela Platforms $model->setRelationRecords('platforms', is_array(@$_POST['Platforms']) ? $_POST['Platforms'] : array()); if ($model->save()) { Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, '<strong>Well!</strong> Test Case saved with sucess!'); Yii::app()->controller->refresh(); } } } catch (Exception $e) { Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, '<strong>Ops!</strong> ERROR!'); Yii::app()->controller->refresh(); } $this->render('create', array('model' => $model)); }