-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Milestone
Description
Autowiring is a nice replacement for the removed interface injection. It is also mainly useful for controllers:
class MyController
{
/**
* @Autowire
* @var Symfony\Component\HttpFoundation\Request
*/
private $request;
}
The dependency injection container would automatically inject the "request" service into MyController::$request using property injection. The benefit is again less code to write (or configuration), faster development, and no container dependency in the controller. However, in contrast to method injection services would not be lazy-loaded.