public function getRouteCollectionForRequest(Request $request)
{
$collection = new RouteCollection();
$path = $request->getPathInfo();
$prefix = $this->requestAnalyzer->getResourceLocatorPrefix();
if (!empty($prefix) && strpos($path, $prefix) === 0) {
$path = PathHelper::relativizePath($path, $prefix);
}
$route = $this->findRouteByPath($path, $request->getLocale());
if ($route && array_key_exists($route->getId(), $this->symfonyRouteCache)) {
$collection->add(self::ROUTE_PREFIX . $route->getId(), $this->symfonyRouteCache[$route->getId()]);
return $collection;
}
if (!$route || !$this->routeDefaultsProvider->supports($route->getEntityClass()) || !$this->routeDefaultsProvider->isPublished($route->getEntityClass(), $route->getEntityId(), $route->getLocale())) {
return $collection;
}
$collection->add(self::ROUTE_PREFIX . $route->getId(), $this->createRoute($route, $request));
return $collection;
}