-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes-ish |
Symfony version | 4.1 |
Hi guys!
- controller "action-injection" is a shortcut we added for convenience.
- action-injection works like constructor or method injection for services, but it does not work the same with
bind
:bind
applies to the constructor & methods, but it does NOT work for actions.
For example:
services:
_defaults:
bind:
$isDebug: '%kernel.debug%'
/**
* @Route("/foo/bar")
*/
public function foo($isDebug)
{
}
This will fail. I'd like this to work - because it would make action-injection consistent with other injection. And I think it shouldn't be too difficult: (A) take the binding rules that apply to the controller service, (B) use those to create a map (similar to what we do for the service injection) of controller+argname => value and (C) create another argument (with low priority) that will fill in the argument.
Does anyone see any issues? I'm creating in the hope that someone will take it on :). I can... eventually... would really like to have this.
Cheers!
wouterj