Example #1
0
 /**
  * @param Register $user
  */
 public function register(Register $user)
 {
     $this->headerData();
     $this->view->showView();
     if (!empty($user)) {
         $username = $user->getUsername();
         $password = $user->getPassword();
         $firstName = $user->getFirstName();
         $lastName = $user->getLastName();
         $email = $user->getEmail();
         $gender = $user->getGender();
         $user = new UserModels($username, $password);
         /**
          * Save only username and password in table users
          */
         $user->save();
         //            var_dump($user);
         $userData = User::createInstance()->getOneByName($username);
         $id = $userData->getId();
         $userInfo = new UserInfoModel($gender, $firstName, $lastName, $email, $id);
         /**
          * save UserInfoController in table user_info
          */
         $userInfo->save();
         if ($id != null) {
             $this->redirectControllers('user', 'index');
         }
     }
     $this->view->part('footer');
 }
Example #2
0
 /**
  * 
  * @param \Repository\User $user
  * @return type
  */
 public function save(\Models\UserModels $user)
 {
     $query = "INSERT INTO users (username, password) VALUES (?, ?)";
     $param = [$user->getUsername(), $user->getPasword()];
     $this->db->query($query, $param);
     return $this->db->row();
 }
Example #3
0
 /**
  * @param Register $user
  */
 public function register(Register $user)
 {
     $this->headerData();
     $this->view->showView();
     if (!empty($user)) {
         $username = $user->getUsername();
         $password = $user->getPassword();
         $user = new UserModels($username, $password);
         $user->save();
     }
 }