Ejemplo n.º 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new UserBuilderProfile();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['UserBuilderProfile'])) {
         $model->attributes = $_POST['UserBuilderProfile'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Ejemplo n.º 2
0
 /**
  * This method accepts a userId and an array of data to creates the builder profile model.
  * Returns the validated model if successfully created.
  * Returns the error validated model if validation fails.
  *
  * data array should have the following hash keys -
  * 1. id (optional)
  * 2. organization_name
  * 3. address_line1
  * 4. address_line2
  * 5. locality_id
  * 6. mobile
  * 7. telephone
  * 8. email
  *
  * @param string $userId
  * @param array $data
  * @return model
  */
 public static function createBuilderProfile($userId, $data)
 {
     $builderprofile = new UserBuilderProfile();
     $builderprofile->attributes = $data;
     $builderprofile->user_id = $userId;
     $builderprofile->save();
     return $builderprofile;
 }