Architecture and request · Question 2 of 12
In which file does an extension configure its services for dependency injection?
1 answer is correct. Easy
Show answer
Answer
- B Configuration/Services.yaml
Explanation
The file Configuration/Services.yaml (alternatively Services.php) defines how the Symfony container treats the extension's classes. Typical is a _defaults block with autowire: true, autoconfigure: true and public: false, plus an entry that loads all classes under Classes/ as services and excludes data objects such as Classes/Domain/Model/*. Without this file, constructor dependencies of the extension's classes are not resolved automatically. composer.json seems related because it handles class autoloading – but it only ensures that PHP can find the classes, not that they are wired as services.