fixed link generation when doing sub-requests
This commit is contained in:
parent
e983029ddc
commit
018c8d548c
@ -136,13 +136,14 @@ class Request
|
||||
'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
|
||||
'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
|
||||
'REMOTE_ADDR' => '127.0.0.1',
|
||||
'SCRIPT_NAME' => '',
|
||||
'SCRIPT_FILENAME' => '',
|
||||
), $server, array(
|
||||
'REQUEST_METHOD' => strtoupper($method),
|
||||
'PATH_INFO' => '',
|
||||
'REQUEST_URI' => $uri,
|
||||
'SCRIPT_NAME' => '',
|
||||
'SCRIPT_FILENAME' => '',
|
||||
'QUERY_STRING' => $queryString,
|
||||
), $server);
|
||||
));
|
||||
|
||||
return new self($request, $query, array(), $cookies, $files, $server);
|
||||
}
|
||||
|
@ -43,26 +43,22 @@ class RequestParser
|
||||
|
||||
public function resolve(Event $event)
|
||||
{
|
||||
if (!$event->getParameter('main_request'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$request = $event->getParameter('request');
|
||||
|
||||
$this->container->setParameter('request.base_path', $request->getBasePath());
|
||||
|
||||
if ($request->path->get('_bundle'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// set the context even if the parsing does not need to be done
|
||||
// to have correct link generation
|
||||
$this->router->setContext(array(
|
||||
'base_url' => $request->getBaseUrl(),
|
||||
'method' => $request->getMethod(),
|
||||
'host' => $request->getHost(),
|
||||
'is_secure' => $request->isSecure(),
|
||||
));
|
||||
$this->container->setParameter('request.base_path', $request->getBasePath());
|
||||
|
||||
if (!$event->getParameter('main_request') || $request->path->has('_bundle'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (false !== $parameters = $this->router->match($request->getPathInfo()))
|
||||
{
|
||||
|
Reference in New Issue
Block a user