Skip to content

Commit 95f9348

Browse files
committed
minor #9419 Fix the explanation about registering commands (javiereguiluz)
This PR was squashed before being merged into the 2.7 branch (closes #9419). Discussion ---------- Fix the explanation about registering commands A question to @xabbuh: we should merge this in 2.7, 2.8 and 3.4, right? Commits ------- 0b101d8 Fix the explanation about registering commands
2 parents b963109 + 0b101d8 commit 95f9348

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

console.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,16 @@ method. Then you can optionally define a help message and the
6464
Registering the Command
6565
-----------------------
6666

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.
67+
Symfony commands must be registered before using them. In order to be registered
68+
automatically, a command must be:
69+
70+
#. Stored in a directory called ``Command/``;
71+
#. Defined in a class whose name ends with ``Command``;
72+
#. Defined in a class that extends from
73+
:class:`Symfony\\Component\\Console\\Command\\Command`.
74+
75+
If you can't meet these conditions for some command, the alternative is to
76+
manually :doc`register the command as a service </console/commands_as_services>`.
7177

7278
Executing the Command
7379
---------------------

0 commit comments

Comments
 (0)