I’m pretty new at Symfony 2 and I was wondering something :
Let’s assume I have 2 bundles in my projects. I want to use entities generated from my database in both bundles.
Where am I suppose to generate the entities ? (To me the best way would be outside the bundles but I can’t find out how to do that)
Thanks for your help.
I think there is two solutions, you have to think of the design of your application.
Are you sure you need two bundles ? If the link is so strong between the two, why didn’t you choose to make only one bundle ? In this case, you’ll just have to generate the entities into this bundle.
Other case : you effectively need two bundles, but in this specific application you need to make a link between the two. In this case, I think you should generate the entities in the bundle where it belongs, and if you need so you can use them in another bundle (thank to
use MyApp\MyBundle\Entities\...;). You have to think in terms of generic code when using Symfony, in order to be able to reuse your bundles in other projects. 😉