-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Symfony version | 3.3 ? probably 3.4 |
A great idea came out on Slack about local bindings.
We could allow injecting services based on type hints on a per service/file basis:
services:
_defaults:
bindings:
BarInterface: '@alternative_bar'
Foo:
bindings:
BarInterface: '@bar'
$quz: 'quzvalue'
This way, @bar
will be injected in any parameter type hinted as BarInterface
(in a constructor or a method signature), but only for this service/file.
Note that bindings could be unused, giving a better solution than #22152 to #21711.
As named parameters are usable in arguments, bindings could be too:
services:
Foo:
arguments:
BarInterface: '@bar'
ping @nicolas-grekas, @lunetics
nicolas-grekas, lunetics, Taluu, ro0NL, sstok and 4 morepeter-gribanov