Example #1
0
 /**
  * This method gets array of data from user.
  * inserts data to database.
  * Returns the model for successful insertion.
  * Returns false if error occurs.
  *
  * @param array $data
  * @return model|false
  */
 public static function createSpecialization($data)
 {
     $specialist = new Specializations();
     $specialist->attributes = $data;
     $specialist->save();
     return $specialist;
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Specializations();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Specializations'])) {
         $model->attributes = $_POST['Specializations'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }