Guest User

Untitled

a guest
Oct 22nd, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1. class UserController extends Controller
  2. {
  3.     public function autoloadModel() {
  4.         return array(
  5.             'userModel'=>'model/userModel.php'
  6.         );
  7.     }
  8.  
  9.     public function actionRegistration()
  10.     {
  11.         try {
  12.             $userName = $this->http->get('userName');
  13.             $password = $this->http->get('password');
  14.             $this->userModel->register($userName, $password);
  15.             $this->userModel->setCity('Unknown');
  16.             $this->userModel->setLng('Russian');
  17.             $this->render->print(array('type' => 'successful'));
  18.         } catch (KeyNotExist $e) {
  19.             $this->render->print(array('type' => 'EmptyAttribute'));
  20.         } catch (UserModelException $e) {
  21.             if ($e->getCode() == 1) {
  22.                 $this->render->print(array('type' => 'UserExist'));
  23.             } elseif ($e->getCode() == 2) {
  24.                 $this->render->print(array('type' => 'BadString'));
  25.             }
  26.  
  27.         } catch (Exception $e) {
  28.             throw new Htpp505Exception();
  29.         }
  30.     }
  31. }
Add Comment
Please, Sign In to add comment