public function registerAction() { $exists = App_Model_User::getCount(['email' => $this->getParam('email')]); if ($exists) { throw new App_Exception_UserAlreadyExists(); } $user = new App_Model_User(['email' => $this->getParam('email'), 'password' => $this->getParam('password'), 'registered' => time()]); $user->addToken(); $user->save(); }