2

I have one master database that hosts all master and transaction details of my users.

Now I would like to have 3 web-applications (symfony2) connected to this database, A B and C. All of them have a local database.

A is for my users, B and C will be admin applications. (Basically these are for different departments within my company that do distinctly different things with info from the master database). The master database is fed by A, but should be able to get modified by B and C too.

Lets say in B I need to assign an activity to a user that has created an account in A and store that info in B's local database.

I have been pondering on this for a month: how do I work with a User Entity in B (coming from A) so that I am still be able to do something like:

$activity = new Activity();
$activity->setUser($user);

Or something like:

$activity->getUser(); 

How can an object relationship be maintained if info needs to come from two different databases?

I am very new to this way of working. Do I need to work with AbstractClasses, or API's or something else?

If someone has at least some tips as to how what I should take in consideration, I would be most grateful.

EDIT: Does this then mean I would need to have two entity classes for, for example, the user entity? One in A, and one in B (and possibly one in C).

The problem is that in A, the user entity has relationships with other entities, than in B. Remember that A and B are different softwares.

I thought maybe I should have a reusable bundle that is used in both A and B? But then again the problem is that some entities have relationships in A that do not exist in B.

In other words, how would I map the same data from the database differently to entities in multiple software.

4

1 回答 1

1

您将需要在配置中设置多个实体管理器。 这个链接会教你怎么做。

于 2015-08-04T19:59:52.223 回答