我的Symfony 2应用程序中安装了SonataAdminBundle,SonataUserBundle和LiipImagineBundle。根据他们的安装说明,我将他们的路由配置放在/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
当我将它们移到/src/MyBundle/Resources/config/routing.yml
时,它们也在工作。那么,我应该把它们放在哪里?什么是最好的配置文件?为什么?我无法决定。
答案 0 :(得分:1)
这是因为我们通常在app/config/routing.yml
文件中导入我们自己的路由器。但是这里有一些缺点,如果你禁用自己的自定义捆绑包,他们也会停止工作。这就是为什么即使您禁用自己的捆绑包也不要破坏应用程序的功能,将它们放入app/config/routing.yml
的原因。