I have SonataAdminBundle, SonataUserBundle and LiipImagineBundle installed in my Symfony 2 application. According to their installation instruction, I put their routing configuration in /app/config/routing.yml
.
_liip_imagine:
resource: "@LiipImagineBundle/Resources/config/routing.xml"
admin:
resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml"
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
sonata_user:
resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
prefix: /admin
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
When I moved them into /src/MyBundle/Resources/config/routing.yml
, they are also working. So, where should I put them? What is the best configuration file to put them? Why? I can't decide.
It's because we usually import our own routers in
app/config/routing.yml
file. But there are some drawbacks here, if you disable your own custom bundle they also stop working. That's why put them intoapp/config/routing.yml
if you want not to break your application's functionality even if you disable your own bundles.