diff --git a/console.rst b/console.rst index 22a5b27b566..5017fd462c2 100644 --- a/console.rst +++ b/console.rst @@ -72,9 +72,7 @@ method. Then you can optionally define a help message and the Executing the Command --------------------- -Symfony registers any PHP class extending :class:`Symfony\\Component\\Console\\Command\\Command` -as a console command automatically. So you can now execute this command in the -terminal: +You can now execute this command in the terminal: .. code-block:: terminal @@ -82,10 +80,12 @@ terminal: .. note:: + The command class must be registered as a service with the ``console.command`` tag. + If you're using the :ref:`default services.yaml configuration `, - your command classes are automatically registered as services. + this is already done for you, thanks to :ref:`autoconfiguration `. - You can also manually register your command as a service by configuring the service + Otherwise, you can manually register your command as a service by configuring the service and :doc:`tagging it ` with ``console.command``. As you might expect, this command will do nothing as you didn't write any logic