diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index 8d50592af0..016189110e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -94,7 +94,7 @@ class Router extends BaseRouter implements WarmableInterface 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 596a8bf897..9917384d3d 100644 --- a/src/Symfony/Component/Routing/RouteCollection.php +++ b/src/Symfony/Component/Routing/RouteCollection.php @@ -259,6 +259,16 @@ class RouteCollection implements \IteratorAggregate, \Countable 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. *