Question

I need two bundles that share some entities. What would be the best approach to implement this ?

I was thinking creating a third bundle that would just include the entities and then using them from within the other 2 bundles, but I'm not sure is this is the best approach...

Thanks

Était-ce utile?

La solution

I too suggest introducing a new bundle to store common entities. Let's say you have two bundles called A and B which have p,q,r entities in common. Introduce another bundle called C and place those p,q,r entities there. So both A and B can reuse those entities without any problem. Another great feature can be achieved by doing this is, you can easily remove A/B bundles without affecting the functionality of the system. But if you have uni-directional/bi-directional relationships, such as pointing from entities p,q,r to any entity in A/B bundle, you can't simply remove those bundles (removing from app kernal and routing). You have to remove the relationship from those entities at first place in order to remove a bundle. I just mentioned the significance of relationship types when it comes to bundle dependency.

So, the bottom line is, use another Bundle to store common entities to avoid duplication and reduce bundle dependability. I would recommend organising bundles according to the functionality of your project, in an independent way is one of the best approach.

Hope this helps,
Cheers!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top