JMSI18nRoutingBundle icon indicating copy to clipboard operation
JMSI18nRoutingBundle copied to clipboard

do not overwrite the router service

Open lsmith77 opened this issue 12 years ago • 8 comments

$container->setAlias('router', 'jms_i18n_routing.router');

this is currently necessary because the bundles router service is defined like so: <service id="jms_i18n_routing.router" class="%jms_i18n_routing.router.class%" parent="router.default" public="false">

instead it would be better to simply decorate router.default

see this hint for how to do it:

[10:53 ] <beberlei> schmittjoh: make your router named router.dfault and rename the original one to router.default.framework or something
[10:54 ] <beberlei> thats what I do when i decorate

lsmith77 avatar Oct 18 '12 09:10 lsmith77

see #44

stof avatar Oct 18 '12 18:10 stof

+1

simonchrz avatar Jun 05 '13 15:06 simonchrz

Ehy @schmittjoh this bundle is very useful, the problem is that, in our application, we've implemented CMF. So we have an app working with symfony2 and we use CMF to publish contents over it and mixing content with our actual App. Now the problem is that with CMF routing the bundle don't work. As @stof and @lsmith77 suggested do you think it is possible to implement composition instead of overwriting the default routing service ? I0'm not sure if I could implement it, but if you or @stof or @lsmith77 could give me more hint on composition I would try to do it.

p365labs avatar Jan 05 '15 10:01 p365labs

Composition was not possible when the first implementation was made. I'm not sure if things changed since then, or not. If you like you can try it, and if it works we can switch to it.

schmittjoh avatar Jan 05 '15 11:01 schmittjoh

@stof @lsmith77 Hi guys I had a look at BeSimple implementation as you suggested on #44, I'm asking you because I need to implement this feature, if possible, in jms_i18n but I would like to understand better the problem with the Router use the better approach possible.

As I understand jms_i18n override getRouteCollection to implement its own loader, and you suggested not to do it but , @stof in #44 , a better approach would be to use composition on the loader instead of doing it in the router

As far as I understand you (@stof) implemented your loader method inside XmlFileLoader and YmlFileLoader, should you suggest to have the same approach ?

And lastly @schmittjoh can you explain better why composition was not possible ?

Thank you guys in advance I'm just trying to understand how jms_i18n, be_simple to find the best solution possible... if the implementation is possible.

p365labs avatar Jan 07 '15 17:01 p365labs

The #102 solved the issue but seems was rejected!

aitboudad avatar Apr 30 '15 19:04 aitboudad

only overwriting router.default and keeping that one available as something else would indeed help. overwriting router is not playing nicely with other bundles.

dbu avatar Jun 01 '15 16:06 dbu

@p365labs I'm trying to use JMSI18nRoutingBundle and CmfRoutingBundle

I succeed to use both of them with this configuration :

cmf_routing:
    dynamic:
        enabled: false
    chain:
        replace_symfony_router: true
        routers_by_id:
            jms_i18n_routing.router: 200
            router.spartan_cms: 100

walva avatar Nov 12 '16 09:11 walva