/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Requirements(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Requirements']) && isset($_POST['requirementsFields'])) { $model->attributes = $_POST['Requirements']; // Set relations attributs values $model->setRelationRecords('requirementsFields', is_array(@$_POST['requirementsFields']) ? $_POST['requirementsFields'] : array()); if ($model->save()) { $this->redirect(array('load', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }