예제 #1
0
 /**
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if ($this->locale || $event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) {
         return;
     }
     // get route name from request
     $route = $this->router->matchRequest($event->getRequest());
     if (empty($route['_route'])) {
         return;
     }
     $route = $route['_route'];
     // go to the install page
     if ($route != 'install' && strpos($route, 'install_') !== 0) {
         $event->setResponse(new RedirectResponse($this->router->generate('install')));
     }
 }
예제 #2
0
 /**
  * @param Request $request
  * @return array
  */
 public function matchRequest(Request $request)
 {
     if (null !== $this->parent) {
         return $this->parent->matchRequest($request);
     }
     return parent::matchRequest($request);
 }
예제 #3
0
파일: Router.php 프로젝트: clastic/clastic
 /**
  * Tries to match a request with a set of routes.
  *
  * If the matcher can not find information, it must throw one of the exceptions documented
  * below.
  *
  * @param Request $request The request to match
  *
  * @return array An array of parameters
  *
  * @throws ResourceNotFoundException If no matching resource could be found
  * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed
  */
 public function matchRequest(Request $request)
 {
     try {
         $parameters = parent::matchRequest($request);
         $canonical = $request->getPathInfo();
     } catch (ResourceNotFoundException $e) {
         $alias = $this->getAliasRepo()->findOneBy(array('alias' => substr($request->getPathInfo(), 1)));
         if (!$alias) {
             throw $e;
         }
         $parameters = $this->getMatcher()->match('/' . $alias->getPath());
         $canonical = $alias->getPath();
     }
     return array_merge($parameters, array('_canonical' => $canonical));
 }
예제 #4
0
 /**
  * @param Request $request
  * @return array
  */
 public function matchRequest(Request $request)
 {
     $this->setApiVersion();
     return parent::matchRequest($this->requestStack->getCurrentRequest());
 }
 /**
  * {@inheritdoc}
  */
 public function matchRequest(Request $request)
 {
     $match = parent::matchRequest($request);
     $this->setMatchContext($match);
     return $match;
 }
예제 #6
0
 /**
  * @param Request $request
  * @return array
  */
 public function matchRequest(Request $request)
 {
     $match = parent::matchRequest($request);
     return $this->processMatch($match);
 }