/**
* Will create a symfony route.
*
* @param RouteInterface $route
* @param Request $request
*
* @return Route
*/
protected function createRoute(RouteInterface $route, Request $request)
{
$routePath = $this->requestAnalyzer->getResourceLocatorPrefix() . $route->getPath();
if ($route->isHistory()) {
return new Route($routePath, ['_controller' => 'SuluWebsiteBundle:Redirect:redirect', 'url' => $request->getSchemeAndHttpHost() . $this->requestAnalyzer->getResourceLocatorPrefix() . $route->getTarget()->getPath() . ($request->getQueryString() ? '?' . $request->getQueryString() : '')]);
}
$symfonyRoute = $this->proxyFactory->createProxy(Route::class, function (&$wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, &$initializer) use($routePath, $route, $request) {
$initializer = null;
// disable initialization
$wrappedObject = new Route($routePath, $this->routeDefaultsProvider->getByEntity($route->getEntityClass(), $route->getEntityId(), $request->getLocale()));
return true;
});
return $this->symfonyRouteCache[$route->getId()] = $symfonyRoute;
}