Associations of organizations of different managers

I have a small question about the doctrine and Symfony 2:

Is it possible to declare a relationship (OneToMany) between two objects that are managed by two different entity managers (and two different DB connections)?

To be more precise, I have two packages:

  • FpnABundle using A_database (and A_entitymanager )
  • FpnBBundle Displayed using B_database (and B_entitymanager )

And I need to define the relationship between FpnABundle:User and FpnBBundle:Post

If I try to do this when I am updating the database schema, I have the following error:

 The class 'Fpn\ABundle\Entity\User' was not found in the chain configured namespaces Fpn\BBundle\Entity 

Thank you for your help!

+2
source share
1 answer

In principle, the answer is no.

You probably need to do this: http://symfony.com/doc/current/cookbook/doctrine/resolve_target_entity.html

Even so, it will only work if two databases are on the same server. And at some point, you probably need to add the schema name to the table name. Somewhat painful.

+2
source

All Articles