【发布时间】:2014-02-11 14:37:15
【问题描述】:
我是Symfony2的初学者,刚刚遇到了一些问题。
我有 2 个捆绑包,都使用注释作为路由器,它们共享一个名为 mydb 的 orm 数据库。当我打算使用 FOSUserBundle 时,我将这些代码放在 app/coconfig/route.yml 中,就像文档中所说的那样:
# app/config/routing.yml
fos_user_security: resource: "@FOSUserBundle/Resources/config/routing/security.xml"
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_resetting: resource: "@FOSUserBundle/Resources/config/routing/resetting.xml" prefix: /resetting
fos_user_change_password: resource: "@FOSUserBundle/Resources/config/routing/change_password.xml" prefix: /profile
当我使用命令 php app/console dictionary:schema:update --force 时,命令告诉我“名称为 'mydb.apply' 的表已经存在”,apply 是数据库的一个表。
那么,为什么会发生这些事情呢?我在网上搜索,发现这可能是因为两个捆绑包共享同一个数据库。更好的解决方案是将这些代码放在 bundle/Resources/config/route.yml 而不是 app/config/route.yml 中,然后将这些代码添加到 app/config/route.yml 中:
FirstBundle:
resource: "@FirstBundle/Resources/config/route.yml"
不幸的是我选择了注解作为我的路由器,我应该如何处理这个问题?
【问题讨论】:
标签: symfony annotations yaml