/** * This method accepts age and adds the record. * Returns model if successfully created. * Returns the error validated model if validation fails. * * * @param string $age * @return model || model with errors */ public static function create($age) { $propertyAgeOfConstruction = new PropertyAgeOfConstruction(); $propertyAgeOfConstruction->age = $age; $propertyAgeOfConstruction->save(); return $propertyAgeOfConstruction; }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new PropertyAgeOfConstruction(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['PropertyAgeOfConstruction'])) { $model->attributes = $_POST['PropertyAgeOfConstruction']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }