From 8d9cd42acdc0baea285046428f7fcaf8da6909a2 Mon Sep 17 00:00:00 2001 From: 2manypeople Date: Tue, 26 Feb 2013 13:42:14 -0300 Subject: [PATCH] Routing issue with installation in a sub-directory ref: https://github.com/symfony/symfony/issues/7129 --- src/Symfony/Bundle/FrameworkBundle/Routing/Router.php | 2 +- src/Symfony/Component/Routing/RouteCollection.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) 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. *