Why didn't we import services inside the bundle?
You may have noticed that we have a service.yml
file in our AppBundle
that is not imported to config.yml
:
# app/config/config.yml imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: services.yml } #app/config/services.yml - { resource: @AppBundle/Resources/config/admin.yml } { resource: sonata_classification.yml }
How come our mava_util
service (which has been configured in src/AppBundle/Resources/config/services.yml
) works?
Please bear in mind that there is nothing wrong with adding another resource line as follows:
- { resource: @AppBundle/Resources/config/services.yml }
We are about to see another Symfony feature that makes bundles more decoupled.
When we generate a bundle with the Symfony console, a folder named DependencyInjection
with the following classes is created:
AppBundle |- … |_ DependencyInjection |- Configuration.php |_ AppExtension.php
The AppExtension...