Description
In Symfony 3.4, services are private by default and the general tendency is to move away from using the Service Container, and use the Dependency Injection instead, whenever possible.
The documentation of Console Commands, though, still advocates extending ContainerAwareCommand and getting the container to get any service the command is relying on.
It would be interesting to precede this with a section explaining how to inject services directly into the command, like what is done in the Controller documentation page (https://symfony.com/doc/current/controller.html#fetching-services-as-controller-arguments). I suppose the recommended way is to use the autowiring of __construct
, so this could be a side note in the section that says "your command classes are automatically registered as services.".