diff options
author | Tobias Schultze <webmaster@tubo-world.de> | 2012-04-16 10:25:33 +0200 |
---|---|---|
committer | Tobias Schultze <webmaster@tubo-world.de> | 2012-12-13 20:13:09 +0100 |
commit | ed4ef95eaef2a0fa0ab8b825cc3e2abcaa55381c (patch) | |
tree | c910001e0fe919f871b1aff9a4ec7808ab756bc8 /Http/HttpUtils.php | |
parent | 2b733ec2d017d7f02f2c034950337e36015acf99 (diff) | |
download | symfony-security-ed4ef95eaef2a0fa0ab8b825cc3e2abcaa55381c.zip symfony-security-ed4ef95eaef2a0fa0ab8b825cc3e2abcaa55381c.tar.gz symfony-security-ed4ef95eaef2a0fa0ab8b825cc3e2abcaa55381c.tar.bz2 |
[Routing] add support for path-relative and scheme-relative URL generation
Diffstat (limited to 'Http/HttpUtils.php')
-rw-r--r-- | Http/HttpUtils.php | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Http/HttpUtils.php b/Http/HttpUtils.php index 76cfc6a..6a2da08 100644 --- a/Http/HttpUtils.php +++ b/Http/HttpUtils.php @@ -67,8 +67,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)) { @@ -127,15 +127,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); } } |