I've been using the FOSUserBundle and the FOSOAuthBundle without issue in a project for a while now, but I've recently added another DB connection and another entity manager and, as a result, can no longer rely on auto_mapping.
I've added mapping for both of the bundles to one of the entity managers and everything seemed to be working OK.
However I've found an issue with the User no longer generating the correct schema when running app/console doctrine:schema:create
, suggesting a mapping issue. It's worth noting that the client from FOSOAuthBundle is mapping OK.
It looks to me that the mapping in the FOSUserBundle is being ignored and I'm not sure what I'm doing wrong.
Entity Manager set up:
orm:
default_entity_manager: default
auto_generate_proxy_classes: %kernel.debug%
entity_managers:
other:
connection: other
mappings:
SteveMainBundle: ~
default:
connection: default
mappings:
SteveMainBundle: ~
SteveWebBundle: ~
FOSUserBundle: ~
FOSOAuthServerBundle: ~
fos_user set up:
fos_user:
db_driver: orm
firewall_name: main
user_class: Steve\MainBundle\Entity\User
Any ideas?
See this question for a possible solution.
you can specify a specific entity manager to be used with the command by adding
em="entitymanager_name"
.We solved this by upgrading the FOSUserBundle to the latest release (2.0). Not really sure what happened in this case, if it was a bug in the version we were on or not. Shall post here if I find out any more.
You can set a custom entity manager by
option. Look into documentation