Closed
Description
Description
I'd like to suggest to integrate everything an extension class can do into the bundle class. This would simplify the bundle structure while leaving extensions as a separate concept for use with the standalone DependencyInjection component.
This is why:
- Almost every bundle needs an extension to load services (because that's the main selling point for bundles). Therefore, the extension class is in practice "mandatory", but is currently treated as being optional while the bundle class is promoted as important yet is mostly empty.
- The extension is magically loaded if it has a certain name and lies within a certain namespace. This is error-prone and not straight-forward.
- The bundle class is the most prominent "entry point" for a bundle, although it doesn't do much. For beginners, it would be easier to understand what a bundle does if they only had to look into the bundle class. Not having to find the extension and to understand its importance would improve comprehensibility of the bundle concept.
The default location of the optional configuration class could then be at the bundle root. Integrating this into the bundle class would be a bit much. A new default location for compiler passes would then make sense.
(maybe it makes sense to load all XML and YAML files in Resources/config automatically if the extension/bundle class does not specify else, so that even less code is required. But this is better discussed in a separate issue)
WDYT?