1

我在 Symfony 2 应用程序中安装了SonataAdminBundleSonataUserBundleLiipImagineBundle 。根据他们的安装说明,我把他们的路由配置放在/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,它们也在工作。那么,我应该把它们放在哪里?放置它们的最佳配置文件是什么?为什么?我无法决定。

4

1 回答 1

1

这是因为我们通常在app/config/routing.yml文件中导入我们自己的路由器。但是这里有一些缺点,如果您禁用自己的自定义捆绑包,它们也会停止工作。app/config/routing.yml如果您不想破坏应用程序的功能,即使您禁用了自己的包,这就是为什么要将它们放入其中的原因。

于 2015-06-10T05:45:56.650 回答