diff options
Diffstat (limited to 'Http/HttpUtils.php')
-rw-r--r-- | Http/HttpUtils.php | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/Http/HttpUtils.php b/Http/HttpUtils.php index 81893ff..eb7894c 100644 --- a/Http/HttpUtils.php +++ b/Http/HttpUtils.php @@ -35,7 +35,7 @@ class HttpUtils * Constructor. * * @param UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance - * @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher + * @param UrlMatcherInterface|RequestMatcherInterface $urlMatcher The Url or Request matcher */ public function __construct(UrlGeneratorInterface $urlGenerator = null, $urlMatcher = null) { @@ -71,8 +71,8 @@ class HttpUtils public function createRequest(Request $request, $path) { $newRequest = Request::create($this->generateUri($request, $path), 'get', array(), $request->cookies->all(), array(), $request->server->all()); - if ($session = $request->getSession()) { - $newRequest->setSession($session); + if ($request->hasSession()) { + $newRequest->setSession($request->getSession()); } if ($request->attributes->has(SecurityContextInterface::AUTHENTICATION_ERROR)) { @@ -136,15 +136,10 @@ class HttpUtils return $request->getUriForPath($path); } - return $this->generateUrl($path, true); - } - - private function generateUrl($route, $absolute = false) - { if (null === $this->urlGenerator) { throw new \LogicException('You must provide a UrlGeneratorInterface instance to be able to use routes.'); } - return $this->urlGenerator->generate($route, array(), $absolute); + return $this->urlGenerator->generate($path, array(), UrlGeneratorInterface::ABSOLUTE_URL); } } |