Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserController extends Controller
- {
- public function autoloadModel() {
- return array(
- 'userModel'=>'model/userModel.php'
- );
- }
- public function actionRegistration()
- {
- try {
- $userName = $this->http->get('userName');
- $password = $this->http->get('password');
- $this->userModel->register($userName, $password);
- $this->userModel->setCity('Unknown');
- $this->userModel->setLng('Russian');
- $this->render->print(array('type' => 'successful'));
- } catch (KeyNotExist $e) {
- $this->render->print(array('type' => 'EmptyAttribute'));
- } catch (UserModelException $e) {
- if ($e->getCode() == 1) {
- $this->render->print(array('type' => 'UserExist'));
- } elseif ($e->getCode() == 2) {
- $this->render->print(array('type' => 'BadString'));
- }
- } catch (Exception $e) {
- throw new Htpp505Exception();
- }
- }
- }
Add Comment
Please, Sign In to add comment