@@ -14,14 +14,12 @@ the ``ContainerAwareCommand`` interface, Symfony will even inject the container.
14
14
While making life easier, this default implementation has some drawbacks in some
15
15
situations:
16
16
17
- * What if you want your command to be defined elsewhere than in the ``Command ``
18
- directory?
19
- * what if you want to conditionally register your command, depending on the
20
- current environment or on the availability of some dependencies?
21
- * what if you need to access dependencies before the ``setContainer() `` is
22
- called (for example in the ``configure() `` method)?
23
- * what if you want to reuse a command many times, but with different
24
- dependencies or parameters?
17
+ * Define the command elsewhere than in the ``Command `` directory;
18
+ * Conditionally register your command, depending on the current environment or
19
+ on the availability of some dependencies;
20
+ * Access dependencies before the ``setContainer() `` is called (for example in
21
+ the ``configure() `` method);
22
+ * Reuse a command many times, but with different dependencies or parameters
25
23
26
24
To solve those problems, you can register your command as a service by simply
27
25
defining it with the ``console.command `` tag:
@@ -73,7 +71,7 @@ pass one of the following as the 5th argument of ``addOption()``:
73
71
74
72
With a ``ContainerAwareCommand `` you wouldn't be able to retrieve the
75
73
configuration parameter, because the ``configure() `` method is called in the
76
- constructor. The only solution is to inject them through it ::
74
+ constructor. The only solution is to inject them::
77
75
78
76
// src/Acme/DemoBundle/Command/GreetCommand.php
79
77
namespace Acme\DemoBundle\Command;
@@ -114,6 +112,6 @@ constructor. The only solution is to inject them through it::
114
112
115
113
.. caution ::
116
114
117
- When running the console, every commands are instanciated , which means every
118
- ``configure() `` methods are called. Be careful with database queries, as
119
- this could impact performances .
115
+ When running the console, every command is instantiated , which means every
116
+ ``configure() `` method is called. Be careful with database queries, as
117
+ they could impact performance .
0 commit comments