Skip to content

Commit

Permalink
unset _locale parameter if matching route has been found
Browse files Browse the repository at this point in the history
  • Loading branch information
uwej711 committed Apr 4, 2013
1 parent 4706313 commit 44c40fa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ContentAwareGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function generate($name, $parameters = array(), $absolute = false)
*
* @throws RouteNotFoundException if there is no route found for the provided name
*/
protected function getRouteByName($name, array $parameters)
protected function getRouteByName($name, array &$parameters)
{
$route = $this->provider->getRouteByName($name, $parameters);
if (empty($route)) {
Expand All @@ -98,7 +98,7 @@ protected function getRouteByName($name, array $parameters)
*
* @return SymfonyRoute either the passed route or an alternative with better locale
*/
protected function getBestLocaleRoute(SymfonyRoute $route, $parameters)
protected function getBestLocaleRoute(SymfonyRoute $route, &$parameters)
{
if (! $route instanceof RouteObjectInterface) {
// this route has no content, we can't get the alternatives
Expand All @@ -111,6 +111,7 @@ protected function getBestLocaleRoute(SymfonyRoute $route, $parameters)
$routes = $content->getRoutes();
$contentRoute = $this->getRouteByLocale($routes, $locale);
if ($contentRoute) {
unset($parameters['_locale']);
return $contentRoute;
}
}
Expand Down Expand Up @@ -167,6 +168,7 @@ protected function getRouteByContent($name, &$parameters)

$route = $this->getRouteByLocale($routes, $this->getLocale($parameters));
if ($route) {
unset($parameters['_locale']);
return $route;
}

Expand Down

0 comments on commit 44c40fa

Please sign in to comment.