简体   繁体   中英

Symfony2, Doctrine2, relation between different databases

a few days ago I found that sf2 can manage several connection. http://symfony.com/doc/current/cookbook/doctrine/multiple_entity_managers.html

And it's great but... I have a question about selection. Is there any solution to select automatically and compare entity? For example we have simple relation between entities in one database, but can we do the same using different entity managers? Of course I'm not talking about 'real' relation, but if I want to simple add query.. In short can I do this one - when I select entity from first db, selection of another item by ID starts and I have something like 'relation tables with different databases'

I think you could do it like this:

For table #1 do @Table(name="db1.name_of_first_table") , and for second table @Table(name="db2.name_of_second_table") ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM