[英]Symfony2 using multiple databases with fosuserbundle
我正在尝试在一个symfony2项目中与2位不同的实体经理一起实施fosuserbundle。 我正在使用https://github.com/rollerworks/RollerworksMultiUserBundle将其完成。 我已经按照文档中的所有步骤进行操作,但是出现错误,我也不知道为什么..
MappingException in MappingException.php line 37:
The class 'IntoPeople\AdminBundle\Entity\User' was not found in the chain
configured namespaces FOS\UserBundle\Model
因此,应在我的security.yml中配置此映射。 我从multiuserbundle文档中复制了以下内容:
orm:
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
FOSUserBundle:
type: xml
dir: '%kernel.root_dir%/../vendor/friendsofsymfony/user-bundle/Resources/config/doctrine-mapping'
prefix: FOS\UserBundle\Model
is_bundle: false
customer:
connection: customer
mappings:
FOSUserBundle:
type: xml
dir: '%kernel.root_dir%/../vendor/friendsofsymfony/user-bundle/Resources/config/doctrine-mapping'
prefix: FOS\UserBundle\Model
is_bundle: false
所以基本上atm我不确定应该更改什么。 我试图设置:
mappings:
FosUserBundle: ~
但这是行不通的。
有人知道我该如何解决?
提前致谢。
编辑:
好的,所以我更改了配置
orm:
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
IntoPeopleAdminBundle: ~
customer:
connection: customer
mappings:
IntoPeopleDatabaseBundle: ~
但是我仍然遇到错误,现在看起来像这样:
The class 'IntoPeople\DatabaseBundle\Entity\User' was not found in the chain
configured namespaces IntoPeople\AdminBundle\Entity, FOS\UserBundle\Model
更改
orm:
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
FOSUserBundle:
type: xml
dir: '%kernel.root_dir%/../vendor/friendsofsymfony/user-bundle/Resources/config/doctrine-mapping'
prefix: FOS\UserBundle\Model
is_bundle: false
customer:
connection: customer
mappings:
FOSUserBundle:
type: xml
dir: '%kernel.root_dir%/../vendor/friendsofsymfony/user-bundle/Resources/config/doctrine-mapping'
prefix: FOS\UserBundle\Model
is_bundle: false
至
orm:
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
IntoPeopleAdminBundle: ~
customer:
connection: customer
mappings:
IntoPeopleAdminBundle: ~
扩展FOSUserBundle
的基类时,无需定义FOSUserBundle
映射。 该解决方案应该起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.