Override FOSUserBundle routes Symfony2

浪尽此生 提交于 2019-12-03 16:38:09

First of all the the yaml routes are not working because the FOSUserBundle Routes are defined in xml. So your yaml routes won't imported.

here the FOSUserBundle Routes: https://github.com/FriendsOfSymfony/FOSUserBundle/tree/master/Resources/config/routing

If the FOSUserBundle is the parent bundle of your userbundle you are able to rewrite the FOSUserBundle routing resources. How to do this is explained here: http://symfony.com/doc/current/cookbook/bundles/inheritance.html#overriding-resources-templates-routing-etc

Further more to answer to the last point how to pass the locale into the route is described here: http://symfony.com/doc/current/cookbook/bundles/inheritance.html#overriding-resources-templates-routing-etc

<route id="contact" path="/{_locale}/contact">
    <default key="_controller">AcmeDemoBundle:Contact:index</default>
    <requirement key="_locale">%locales%</requirement>
</route>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!