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 ...

Get Mastering Symfony now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.