Open timvermaercke opened 9 years ago
You can also extend I18nRouter:
class MyRouter extends I18nRouter
{
}
<service id="my_router" class="MyBundle\Routing\MyRouter" parent="jms_i18n_routing.router" public="false">
</service>
Make sure to load your own bundle behind the I18nRoutingBundle:
public function registerBundles()
{
$bundles = array(
new JMS\I18nRoutingBundle\JMSI18nRoutingBundle(),
new MyBundle\Bundle(),
);
return $bundles;
}
Finally use a compiler pass to override the alias:
public function process(ContainerBuilder $container)
{
$container->setAlias('router', 'my_router');
}
This was no option for us. We fixed it by adding a custom CompilerPass.
Hi
We're using two bundles (i18nRoutingBundle and one of our own) that will alter the Symfony routing. The problem we had is that our bundle was ignored because the i18n bundle always took the upper hand and our dynamic routing wasn't loaded.
We've found a solution to get them both working but for that we needed to add an option, whether or not the bundle's router replaces the standard Symfony router. If we do this, the JMSi18nBundle plays nicely with other bundles.