Browse Source

[HttpFoundation] added a way to generate a URI based on the current one and a path

Fabien Potencier 14 years ago
parent
commit
94347f73c5
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/Symfony/Component/HttpFoundation/Request.php

+ 12 - 0
src/Symfony/Component/HttpFoundation/Request.php

@@ -374,6 +374,18 @@ class Request
         return $this->getScheme().'://'.$this->getHost().':'.$this->getPort().$this->getScriptName().$this->getPathInfo().$qs;
     }
 
+    /**
+     * Generates a normalized URI for the given path.
+     *
+     * @param string $path A path to use instead of the current one
+     *
+     * @return string The normalized URI for the path
+     */
+    public function getUriForPath($path)
+    {
+        return $this->getScheme().'://'.$this->getHost().':'.$this->getPort().$this->getScriptName().$path;
+    }
+
     /**
      * Generates the normalized query string for the Request.
      *