Symfony2: How to generate Entities from MULTIPLE Existing Databases in SAME Bundle? Symfony2: How to generate Entities from MULTIPLE Existing Databases in SAME Bundle? php php

Symfony2: How to generate Entities from MULTIPLE Existing Databases in SAME Bundle?


The first step it to configure multiple entity managers (not connections), one for each database. You then use the --em option on the doctrine commands to specify which entity manager to use.

php app/console doctrine:mapping:import "AcmeBlogBundle" annotation --em=name1php app/console doctrine:mapping:import "AcmeBlogBundle" annotation --em=name2

Be aware that you not going to be able to directly query (join) across multiple database with doctrine. At least not very easily. As long as you plan on limiting your queries to one database at a time then you will be fine.

This is actually a somewhat advanced topic. You might want to spend some time with the doctrine documentation. Might also be easier to get started with one database and then split later.