Skip to content

Commit 16fc248

Browse files
committed
Fix
1 parent 8720124 commit 16fc248

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

console.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,6 @@ For example, you may want a command to create an user::
3838
}
3939
}
4040

41-
If you're using the :ref:`default services.yml configuration <service-container-services-load-example>`,
42-
your command classes are automatically registered as services. You have nothing
43-
else to do!
44-
45-
.. note::
46-
47-
You can also manually register your command as a service by configuring the service
48-
and :doc:`tagging it </service_container/tags>` with ``console.command``.
49-
50-
Symfony also looks in the ``Command/`` directory of bundles for commands
51-
non registered as a service but this is deprecated since Symfony 3.4 and
52-
won't be supported in Symfony 4.0.
53-
5441
Configuring the Command
5542
-----------------------
5643

@@ -77,12 +64,26 @@ method. Then you can optionally define a help message and the
7764
Executing the Command
7865
---------------------
7966

80-
After configuring the command, you can execute it in the terminal:
67+
Symfony registers any PHP class extending from :class:`Symfony\Component\Console\Command\Command`
68+
as a console command automatically, so you can now execute this command in the
69+
terminal:
8170

8271
.. code-block:: terminal
8372
8473
$ php bin/console app:create-user
8574
75+
.. note::
76+
77+
If you're using the :ref:`default services.yml configuration <service-container-services-load-example>`,
78+
your command classes are automatically registered as services.
79+
80+
You can also manually register your command as a service by configuring the service
81+
and :doc:`tagging it </service_container/tags>` with ``console.command``.
82+
83+
Otherwise, Symfony looks in the ``Command/`` directory of bundles for commands
84+
non registered as a service but this is deprecated since Symfony 3.4 and
85+
won't be supported in Symfony 4.0.
86+
8687
As you might expect, this command will do nothing as you didn't write any logic
8788
yet. Add your own logic inside the ``execute()`` method, which has access to the
8889
input stream (e.g. options and arguments) and the output stream (to write

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy