function getCommand(Request $req) { $previous = $req->getLastCommand(); if (is_null($previous)) { $cmd = $req->getProperty('cmd'); if (is_null($cmd)) { $req->setProperty('cmd', 'default'); return self::$default_cmd; } } else { $cmd = $this->getForward($req); if (is_null($cmd)) { return null; } } $cmd_obj = $this->resolveCommand($cmd); if (is_null($cmd_obj)) { throw new core\AppException("couldn't resolve '{$cmd}'"); } $cmd_class = get_class($cmd_obj); if (isset($this->invoked[$cmd_class])) { throw new core\AppException("circular forwarding"); } $this->invoked[$cmd_class] = 1; return $cmd_obj; }
private function insertUser(Request $request) { $email = $request->get('email'); $password = $request->get('password'); $user = new User(); $user->setEmail($email); $user->setPassword($this->hasher->hashPassword($password)); $user->setRole(UserRole::ROLE_USER); $this->em->persist($user); $this->em->flush(); }
function doExecute(ctrl\Request $req) { $appName = core\ApplicationRegistry::getAppName(); $req->addFeedback("Welcome to {$appName}"); }
function doExecute(ctrl\Request $req) { $appName = core\ApplicationRegistry::getAppName(); $req->addFeedback("Please, enter your {$appName} username and password."); }