Skip to content

[Templating] Fix to support CachedRouter's in RouteHelper. #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Routing/CachedRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,14 @@ public function match($url)
{
return $this->matcher->match($url);
}

/**
* Gets the UrlGenerator instance associated with this Router.
*
* @return UrlGeneratorInterface A UrlGeneratorInterface instance
*/
public function getGenerator()
{
return $this->generator;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;

use Symfony\Component\Templating\Helper\Helper;
use Symfony\Component\Routing\Router;
use Symfony\Component\Routing\RouterInstance;

/**
* RouterHelper manages links between pages in a template context.
Expand All @@ -26,9 +26,9 @@ class RouterHelper extends Helper
/**
* Constructor.
*
* @param Router $router A Router instance
* @param RouterInstance $router A Router instance
*/
public function __construct(Router $router)
public function __construct(RouterInstance $router)
{
$this->generator = $router->getGenerator();
}
Expand Down