Reputation: 2783
Let's say I have a complex structured SF2 application composed of several bundles such as CoreBundle, ApiMobileBundle, ApiPartnerBundle, WebsiteOneBundle, WebsiteTwoBundle, Backoffice1Bundle, Backoffice2Bundle, SearchBundle, UserBundle, LogBundle and so on...
Till now, everything went fine with the application being versionned under one unique GIT repository. But today, we want to create another application which could benefit of some of the bundles of the main application. Note that the resulting applications will not be deployed on the same servers.
To put it simply, we want to share several bundles whithin several SF2 applications. What are your recommendations?
Edit
I'm asking this question because one of the developers I'm working with says it's pure heresy and not in the SF2 philosophy (regarding skeleton of application, vendors management, config files etc...). He argues that the best approach is to keep everything into the same application and that deploying unecessary sources is not a problem ...
Upvotes: 0
Views: 96
Reputation: 985
You could have some trouble if you have Doctrine entities which are related between the bundles. If you decide to use a bundle, whose entity is related to another unused bundle, you will be having problems with Doctrine, explained here. That's why it is a good idea to use interfaces for entity relations and ResolveTargetEntityListener. (That is, if you're using Doctrine.)
I think I have a quite simple solution to the missing entity problem which I plan to post on the previous link in the next couple of days, first thing when I get the time to implement it, test it and post it.
The idea is to basically keep all the bundles as stand-alone as possible. Don't keep anything in your core bundle unless you're sharing it across multiple bundles or if it's of the utmost importance for your project in general to work. But the biggest problem that I've found so far are those darn entities.
Upvotes: 1
Reputation: 398
Your best bet would be to extract the bundles out of the project and store them in their own git repositories.
Then, in your composer.json
file, add them as dependencies to both projects.
Of course, that will also depend on your bundle being decoupled from the application, but that's a design factor and another question altogether.
Hope that helps.
Upvotes: 2