Beispiel #1
0
 public static function testCreate()
 {
     //        $user = R::dispense('user');
     $user = new User();
     $user->setUid('newjoe');
     $user->setPassword('test');
     $user->setAge(20);
     UserDAOImpl::doCreate($user);
 }
Beispiel #2
0
 public function run()
 {
     // echo "sign up model";
     $user = $this->propareVO();
     // if Email not exists, continue to create
     if (!UserDAOImpl::findByEmail($user->getEmail())) {
         $result = UserDAOImpl::doCreate($user);
         // create user in db
         if ($result) {
             // send mail
             $iEmailService = new EmailService();
             $iEmailService->setReceiver($user);
             $msg = $iEmailService->sendEmail();
             // header('location: ../login');
         } else {
             $msg = SQL_EXCEPTION_CREATE_USER;
             // show error prompt
         }
     } else {
         $msg = SIGN_UP_DUPLICATE_REGISTER;
     }
     $controller = new Prompt();
     $controller->index($msg);
 }