You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class RouterCacheWarmer implements CacheWarmerInterface
24
25
{
26
+
private$container;
25
27
protected$router;
26
28
27
-
/**
28
-
* Constructor.
29
-
*
30
-
* @param RouterInterface $router A Router instance
31
-
*/
32
-
publicfunction__construct(RouterInterface$router)
29
+
publicfunction__construct($container)
33
30
{
34
-
$this->router = $router;
31
+
if ($containerinstanceof ContainerInterface) {
32
+
$this->container = $container;
33
+
} elseif ($containerinstanceof RouterInterface) {
34
+
$this->router = $container;
35
+
} else {
36
+
thrownew \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface or Symfony\Component\Routing\RouterInterface as first argument.', __CLASS__));
37
+
}
35
38
}
36
39
37
40
/**
@@ -41,6 +44,10 @@ public function __construct(RouterInterface $router)
thrownew \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface or Symfony\Component\Translation\TranslatorInterface as first argument.', __CLASS__));
thrownew \InvalidArgumentException(sprintf('%s only accepts instance of Symfony\Component\DependencyInjection\ContainerInterface or Twig_environment as first argument.', __CLASS__));
36
+
}
37
+
29
38
$this->iterator = $iterator;
30
39
}
31
40
@@ -34,6 +43,10 @@ public function __construct(\Twig_Environment $twig, \Traversable $iterator)
0 commit comments