diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index 8d50592af0247..016189110ed86 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -94,7 +94,7 @@ private function resolveParameters(RouteCollection $collection) foreach ($route->getRequirements() as $name => $value) { $route->setRequirement($name, $this->resolveString($value)); } - + $collection->setPrefix('/'.ltrim($this->resolveString($collection->getPrefix()), '/')); $route->setPattern($this->resolveString($route->getPattern())); } } diff --git a/src/Symfony/Component/Routing/RouteCollection.php b/src/Symfony/Component/Routing/RouteCollection.php index 596a8bf897a48..9917384d3d1a5 100644 --- a/src/Symfony/Component/Routing/RouteCollection.php +++ b/src/Symfony/Component/Routing/RouteCollection.php @@ -259,6 +259,16 @@ public function getPrefix() return $this->prefix; } + /** + * Sets the prefix (used to resolve placeholders). + * + * @param string The prefix + */ + public function setPrefix($prefix) + { + $this->prefix = $prefix; + } + /** * Returns an array of resources loaded to build this collection. *