symfony/symfony-docs — pull request #3620 by gnugat (2014-02-28 23:54:03+00:00)
Title: Console command as service

| Q | A
| ------------- | ---
| Doc fix? | yes
| New docs? | no
| Applies to | 2.4+
| Fixed tickets | N/A

Command as a service can be useful to give access to services and
configuration parameters in the `configure` method.

A simple use case: you want to allow the user to set an option's default
value in the `app/config/parameters.yml` file. Or the default value
needs to be computed by a service (database retrieval for instance).

With a `ContainerAwareCommand`, this wouldn't be possible because the
`configure` method is called from the constructor, so the container
isn't set yet.