Reputation: 1035
I've read a lot of different things about bundles and the architecture of a Symfony2 project, however I've yet to come to a conclusion on the best practice for an individual project which isn't concerned with re-using bundles etc. The reason being that this is a client specific project.
The application is a large website with different sections such as News, Blog, Multi step application form, Contact, Testimonials etc. Each section will need backend and front end functionality e.g News articles can be added by an administrator in the backend and can be viewed in the front end. THe backend will contain some backend only functionality such as Admin Users and will have an admin log which will log the activity of each admin user, therefore this needs to be accessible within each backend section.
I initially thought about having different bundles for each section i.e AdminUserBundle, NewsBUndle, BlogBundle etc before I quickly realised there is a lot of shared layouts/templates and functionality (such as AdminLog). Therefore, what would you suggest would be best practice for this kind of project? I think I've got three options but open to additional suggestions:
Thanks
Upvotes: 0
Views: 2927
Reputation: 2970
According to the Symfony2 documentation:
In Symfony2, a bundle is like a plugin, except that all of the code in your application will live inside a bundle. A bundle is nothing more than a directory that houses everything related to a specific feature, including PHP classes, configuration, and even stylesheets and Javascript files (see The Bundle System).
A Bundle should resolve a business/functional problematic. So I think the third suggestion is a good solution.
You can have a CoreBundle with contains technical problematic like global forms type, forms theme, custom doctrine functions. This bundle doesn't contains business problematic.
And other bundles should only contains business problematic like a bundle for News an other for Blog another for Comments ...
Hope it's helpful.
Best regard
Upvotes: 1