I’m developing two apps in symfony2, One for administration and other public for users. I know the best architecture proposed by some symfony2 gurus is make bundles containing admin and frontend namespaces. But in my case, i don’t do this because the admin and frontend apps need to be deployed in different environments. The admin app will be deployed at intranet (not public access), while the frontend will be deployed in public domain normally. The problem is that two apps use same entities and I don’t know the best way to share this entities between two apps.
I’m developing two apps in symfony2, One for administration and other public for users.
Share
I assume you mean entity classes, and not the actual entities stored in the database. In which case, your problem is easily solved by creating a bundle that holds the entities (and any other code that needs to be shared between the two code bases) and creating a git repository for it. You can then update each project’s
depsfile to refer to this repository. Then, a call tophp bin/vendors installwill add your bundle to thevendordirectory. Just register the bundle with each project and you should be ready to go.Check out the docs on Symfony2 and Git.
Hope this helps.