Exemple #1
0
 public function generateI18nRouteFromCurrentRequest($culture, $referenceType = self::ABSOLUTE_PATH, $scheme = null)
 {
     $result = $this->match($this->context->getPathInfo(), $this->context->getHost(), $this->context->getScheme(), $this->context->getMethod());
     $route = $result['_route'];
     if (strpos($route, ':i18n:') != false) {
         list(, , $route) = explode(':', $route, 3);
     }
     $result['_culture'] = $culture;
     unset($result['_route']);
     $parameters = new ArrayObject($result);
     $this->eventDispatcher->dispatch('Routing.preGenrateI18nRouteFromCurrentRequest', $this, compact('culture', 'referenceType', 'scheme', 'parameters'));
     return $this->generate($route, $parameters->getArrayCopy(), $referenceType, $scheme);
 }
 /**
  * 
  * @param type $serviceName
  * @param type $methodName
  * @param Request $request
  * 
  * @return Response
  */
 public function execute($serviceName, $methodName, Request $request, Response $response = null)
 {
     $this->routing->setCurrentRequest($request);
     if (is_null($response)) {
         $response = new Response();
     }
     $this->eventDispatcher->dispatch('FrontController.preExecute', $this, compact('serviceName', 'methodName', 'response', 'request'));
     $parameters = array_merge($request->query->all(), $request->request->all());
     $service = $this->serviceContainer->getServiceByName($serviceName);
     try {
         $executionResult = $this->invoker->invoke(array($service, $methodName), $parameters, array($request, $response));
     } catch (Exception $e) {
         $executionResult = $this->frontControllerExceptionHandler->handleException($e, $request, $response);
     }
     $finalResponse = $this->completeResponse($executionResult, $request, $response);
     $finalResponse->prepare($request);
     $this->eventDispatcher->dispatch("Response.beforeSend", $finalResponse);
     return $finalResponse;
 }
Exemple #3
0
 public function serviceShutdown()
 {
     $this->eventDispatcher->dispatch('Session.shutdown', $this);
 }