本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Routing\Router::matchRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::matchRequest方法的具体用法?PHP Router::matchRequest怎么用?PHP Router::matchRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Routing\Router
的用法示例。
在下文中一共展示了Router::matchRequest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onKernelRequest
/**
* @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: matchRequest
/**
* @param Request $request
* @return array
*/
public function matchRequest(Request $request)
{
if (null !== $this->parent) {
return $this->parent->matchRequest($request);
}
return parent::matchRequest($request);
}
示例3: matchRequest
/**
* 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: matchRequest
/**
* @param Request $request
* @return array
*/
public function matchRequest(Request $request)
{
$this->setApiVersion();
return parent::matchRequest($this->requestStack->getCurrentRequest());
}
示例5: matchRequest
/**
* {@inheritdoc}
*/
public function matchRequest(Request $request)
{
$match = parent::matchRequest($request);
$this->setMatchContext($match);
return $match;
}
示例6: matchRequest
/**
* @param Request $request
* @return array
*/
public function matchRequest(Request $request)
{
$match = parent::matchRequest($request);
return $this->processMatch($match);
}