Skip to content
Browse files

made I18nRouter compatible with Symfony 2.0 and 2.1 (closes #46)

  • Loading branch information...
1 parent 6578eea commit b747f600e696ce1232262c890a65ee7e610be26e @schmittjoh schmittjoh committed Jun 14, 2012
Showing with 13 additions and 4 deletions.
  1. +13 −4 Router/I18nRouter.php
View
17 Router/I18nRouter.php
@@ -40,11 +40,20 @@ class I18nRouter extends Router
private $redirectToHost = true;
private $localeResolver;
- public function __construct(ContainerInterface $container, $resource, array $options = array(), RequestContext $context = null, array $defaults = array())
+ /**
+ * Constructor.
+ *
+ * The only purpose of this is to make the container available in the sub-class
+ * since it is declared private in the parent class.
+ *
+ * The parameters are not listed explicitly here because they are different for
+ * Symfony 2.0 and 2.1. If we did list them, it would make this class incompatible
+ * with one of both versions.
+ */
+ public function __construct()
{
- parent::__construct($container, $resource, $options, $context, $defaults);
-
- $this->container = $container;
+ call_user_func_array(array('Symfony\Bundle\FrameworkBundle\Routing\Router', '__construct'), func_get_args());
+ $this->container = func_get_arg(0);
}
public function setLocaleResolver(LocaleResolverInterface $resolver)

0 comments on commit b747f60

Please sign in to comment.
Something went wrong with that request. Please try again.