Merge remote branch 'aurelijus/routehelper_cachedrouter_fix'

* aurelijus/routehelper_cachedrouter_fix:
  Add cache warmed routers support to RouteHelper
This commit is contained in:
Fabien Potencier 2011-03-06 10:50:11 +01:00
commit c2e0537c31
2 changed files with 13 additions and 3 deletions

View File

@ -86,4 +86,14 @@ class CachedRouter implements RouterInterface
{ {
return $this->matcher->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;
}
} }

View File

@ -12,7 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Templating\Helper; namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
use Symfony\Component\Templating\Helper\Helper; use Symfony\Component\Templating\Helper\Helper;
use Symfony\Component\Routing\Router; use Symfony\Component\Routing\RouterInterface;
/** /**
* RouterHelper manages links between pages in a template context. * RouterHelper manages links between pages in a template context.
@ -26,9 +26,9 @@ class RouterHelper extends Helper
/** /**
* Constructor. * Constructor.
* *
* @param Router $router A Router instance * @param RouterInterface $router A Router instance
*/ */
public function __construct(Router $router) public function __construct(RouterInterface $router)
{ {
$this->generator = $router->getGenerator(); $this->generator = $router->getGenerator();
} }