0

The following question is not specific to SonataAdminBundle, the same design question remains for all third-parties Bundle, but I took a specific example to make it clearer.

I'm installing SonataAdminBundle for a new Symfony2 application, that will use extensively the Bundle (some kind of backend project).

I read on Sonata documentation (and on many other bundle doc too) that I should put the informations concerning the routing/config/services etc... on the application level, ie: app/config/XXX

However, I don't think it is the right approach in my project. In fact, my "BackendBundle" will be so dependant of SonataAdminBundle, that it won't be able to work without it.

Isn't it more logic to put all those configuration files directly in the Ressource folder of my own "BackendBundle", and not at the application ? In my mind, it is the role of my bundle to handle the Sonata config importation, and not the application role.

2 Answers 2

1

You can also put the routing configuration in a bundle, as soon as you import it from the main routing.yml file.

Bundle documentation use simple examples, to get setup quickly. This is why you'll see very often that way of importing routing resources.

Sign up to request clarification or add additional context in comments.

2 Comments

My idea was to @import Sonata config files into my own BackendModule (Which is a business specific project, and will never be reused for another project).
and then @import the config files of my BackendBundle at the application level. So this idea doesn't sound silly ? Is it the right approach in this case ?
1

You should wire the service dependencies inside your bundle, however the actual configuration of the project belongs to the application.

It's perfectly acceptable for your bundle to be dependant in another bundle, however the configuration you add to it should be related to this dependency in particular and not to configuration itself. The actual configuration belongs to your application, adding project configuration to your bundle makes it effectively non-reusable.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.