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