MV
imports:
- { resource: 'services/*.yaml' }
When loading a configuration file, Symfony loads first the imported files and then it processes the parameters and services defined in the file. If you use the default services.yaml configuration as in the above example, the
App\
definition creates services for classes found in ../src/*
. If your imported file defines services for those classes too, they will be overridden.A possible solution for this is to add the classes and/or directories of the imported files in the
exclude
option of the App\
definition. Another solution is to not use imports and add the service definitions in the same file, but after the App\
definition to override it.