Skip to content

Commit f0469d3

Browse files
committed
minor #9408 Added a short section about registering commands (javiereguiluz)
This PR was squashed before being merged into the 2.7 branch (closes #9408). Discussion ---------- Added a short section about registering commands After merging #9403, I realized that we could add a short section explaining that commands must be registered (although Symfony does this for you most of the times). If we merge this, in 3.4 I'll change the description to mention the autoconfiguration instead of this, which is what #9403 fixed. Commits ------- 2efefea Added a short section about registering commands
2 parents 512b221 + 2efefea commit f0469d3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

console.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,18 @@ method. Then you can optionally define a help message and the
6161
;
6262
}
6363

64+
Registering the Command
65+
-----------------------
66+
67+
Symfony commands must be registered as services and :doc:`tagged </service_container/tags>`
68+
with the ``console.command`` tag. If the PHP class of your command extends from
69+
:class:`Symfony\\Component\\Console\\Command\\Command`, Symfony does this for
70+
you automatically.
71+
6472
Executing the Command
6573
---------------------
6674

67-
After configuring the command, you can execute it in the terminal:
75+
After configuring and registering the command, you can execute it in the terminal:
6876

6977
.. code-block:: terminal
7078

0 commit comments

Comments
 (0)