Beispiel #1
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $keys = UserTableMap::getFieldNames(TableMap::TYPE_FIELDNAME);
     $register_data = array();
     foreach ($data as $key => $value) {
         if (in_array($key, $keys)) {
             $register_data[$key] = $value;
         }
     }
     $register_data["user_pass"] = bcrypt($data['password']);
     $register_data["role_id"] = RoleQuery::getClient();
     $register_data["user_is_validated"] = ConfigQuery::getRegisterMustBeValidated();
     $user = new User();
     $user->fromArray($register_data, TableMap::TYPE_FIELDNAME);
     $user->save();
     return $user;
 }