Skip to content

Commit 0925090

Browse files
committed
[#3031] Adding some details as to why you may or may not want to register a command a service
1 parent 7e7425c commit 0925090

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cookbook/console/console_command.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ Register Commands in the Service Container
7171
Support for registering commands in the service container was added in
7272
version 2.4.
7373

74-
You can register commands in the service container using the ``console.command``
75-
tag:
74+
Instead of putting your command in the ``Command`` directory and having Symfony
75+
auto-discover it for you, you can register commands in the service container
76+
using the ``console.command`` tag:
7677

7778
.. configuration-block::
7879

@@ -108,6 +109,12 @@ tag:
108109
->addTag('console.command')
109110
;
110111
112+
.. tip::
113+
114+
Registering your command as a service gives you more control over its
115+
location and the services that are injected into it. But, there are no
116+
functional advantages, so you don't need register your command as a service.
117+
111118
Getting Services from the Service Container
112119
-------------------------------------------
113120

0 commit comments

Comments
 (0)