Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function registerAction()
- {
- Doctrine_Manager::connection()->beginTransaction();
- try {
- $form = new Form_User_Register();
- if ($this->_request->isPost()) {
- if ($form->isValid($this->_request->getPost())) {
- $user = new Model_User();
- $user->email = $form->getValue('email');
- $user->password = $form->getValue('password');
- $user->save();
- Doctrine_Manager::connection()->commit();
- $this->_helper->success('Registration has been successfully completed. You can login now.');
- $this->_redirect('/login');
- }
- }
- $this->view->form = $form;
- }
- catch (Doctrine_Connection_Exception $e) {
- if ($e->getPortableCode() == Doctrine_Core::ERR_ALREADY_EXISTS) {
- Doctrine_Manager::connection()->rollback();
- $this->registerAction();
- }
- }
- catch (Exception $e) {
- Doctrine_Manager::connection()->rollback();
- throw $e;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement