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