Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
[DI] Allow autowiring by type + parameter name #28234
In #27165, we introduced the possibility to bind by type+name:
bind: Psr\Log\LoggerInterface $myLogger: @monolog.logger.my_logger
But we forgot about aliases. For consistency, they could and should allow doing the same. More importantly, this will open up interesting use cases where bundles could provide default values for typed+named arguments (using the new
services: Psr\Cache\CacheItemPoolInterface $appCacheForecast: @app.cache.forecast
Works also for controller actions and service subscribers (using the real service id as the key).
referenced this pull request
Aug 20, 2018
Now with a new
weaverryan left a comment
I love this. It solves the last weird autowiring situation in an automated way: classes that have multiple services (cache, log, etc).
We'll need to update