Advertisement
Guest User

Untitled

a guest
May 5th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. public function registerAction()
  2. {
  3.     Doctrine_Manager::connection()->beginTransaction();
  4.  
  5.     try {
  6.         $form = new Form_User_Register();
  7.  
  8.         if ($this->_request->isPost()) {
  9.             if ($form->isValid($this->_request->getPost())) {
  10.                 $user = new Model_User();
  11.                 $user->email = $form->getValue('email');
  12.                 $user->password = $form->getValue('password');
  13.                 $user->save();
  14.  
  15.                 Doctrine_Manager::connection()->commit();
  16.  
  17.                 $this->_helper->success('Registration has been successfully completed. You can login now.');
  18.                 $this->_redirect('/login');
  19.             }
  20.         }
  21.  
  22.         $this->view->form = $form;
  23.     }
  24.     catch (Exception $e) {
  25.         Doctrine_Manager::connection()->rollback();
  26.         throw $e;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement