FOSUserBundle
FOSUserBundle copied to clipboard
Multiple connection does not work
Hi,
I tried to upgrade from FOSUserBundle 1.* to 2.* but the last version seem to not support multiple.
Example in my symfony config.yml file :
doctrine: orm: entity_managers: default: connection: default mappings : AppBundle: ~ FOSUserBundle: ~ reseau: connection: reseau mappings : AppBundle: ~ FOSUserBundle: ~ dbal: default_connection: default types: jsonb: Boldtrn\JsonbBundle\Types\JsonbArrayType json: Sonata\Doctrine\Types\JsonType connections: default: driver: pdo_pgsql host: '%database_host%' port: '%database_port%' dbname: '%database_name%' user: '%database_user%' password: '%database_password%' charset: UTF8 reseau: driver: pdo_pgsql host: '%database_host1%' port: '%database_port1%' dbname: '%database_name1%' user: '%database_user1%' password: '%database_password1%' charset: UTF8
`
When I try to call multiple connection in the same action, I got an error : ` $repod = $this->getDoctrine()->getRepository(User::class, 'default'); $user1 = $repod->findAll();
$repor = $this->getDoctrine()->getRepository(User::class, 'reseau');
$user2 = $repor->findAll();`
`
Looks like this is not an issue. You have duplicated the mapping:
doctrine:
orm:
entity_managers:
default:
connection: default
mappings:
AppBundle: ~ <<<<<<<
FOSUserBundle: ~ <<<<<<<
reseau:
connection: reseau
mappings :
AppBundle: ~ <<<<<<<
FOSUserBundle: ~ <<<<<<<
Remove one of the mappings e. g. like this:
doctrine:
orm:
entity_managers:
default:
connection: default
mappings:
FOSUserBundle: ~
reseau:
connection: reseau
mappings :
AppBundle: ~