Hi,
I'm involved in building a number of Symfony 2 applications, many of which will need to share similar admin functionality based on the Sonata Admin bundle. Of course, I don't want to copy and paste code between projects. :)
Suppose I have a bundle src/Acme/AdminBundle that provides the following:
* Log in/out (using entities in src/Application/Sonata/UserBundle/Entity)
* Dashboard
* Administer users and groups (using entities in src/Application/Sonata/UserBundle/Entity)
* Administer Feature X (using entities in src/Acme/FeatureXBundle/Entity)
* Administer Feature Y (using entities in src/Acme/FeatureYBundle/Entity)
If Feature X and Feature Y both have several admin pages, and could be used by several different web applications, I might be tempted to create the following bundles:
* src/Acme/AdminBundle - base admin bundle including the user/group admin, default dashboard and log in/out
* src/Acme/FeatureXAdminBundle - bundle that adds admin pages for Feature X
* src/Acme/FeatureYAdminBundle - bundle that adds admin pages for Feature Y
The idea is that any application could bring in the admin bundles needed, with the appropriate entries in config.yml.
So my questions are:
1. Is the above possible using Symfony 2 / Sonata Admin?
2. Is it a desirable approach anyway?
3. Is there an alternative way to provide this flexibility?
I've tried putting the above into practice, but it seems the closest I can get involves having one 'main' AdminBundle with a config/services.yml defining services with reference to all the other Admin bundles. Also tried, unsuccessfully so far, to use bundle inheritance.
Thanks,
Lars.