Skip to content

Commit b08bbd0

Browse files
committed
feature #7052 Added an article about private console commands (javiereguiluz, wouterj)
This PR was submitted for the master branch but it was merged into the 3.2 branch instead (closes #7052). Discussion ---------- Added an article about private console commands This documents symfony/symfony#20029. Commits ------- d1cb043 Reflect private to hidden renaming in the file name 01f474f Reflect renaming from private to hidden 9415643 Added an article about private console commands
2 parents 5eb2eeb + d1cb043 commit b08bbd0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

console/hide_commands.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
How to Hide Console Commands
2+
============================
3+
4+
By default, all console commands are listed when executing the console application
5+
script without arguments or when using the ``list`` command.
6+
7+
However, sometimes commands are not intended to be executed by end-users; for
8+
example, commands for the legacy parts of the application, commands exclusively
9+
executed through scheduled tasks, etc.
10+
11+
In those cases, you can define the command as **hidden** by setting the
12+
``setHidden()`` method to ``true`` in the command configuration::
13+
14+
// src/AppBundle/Command/LegacyCommand.php
15+
namespace AppBundle\Command;
16+
17+
use Symfony\Component\Console\Command\Command;
18+
19+
class LegacyCommand extends Command
20+
{
21+
protected function configure()
22+
{
23+
$this
24+
->setName('app:legacy')
25+
->setHidden(true)
26+
// ...
27+
;
28+
}
29+
}
30+
31+
Hidden commands behave the same as normal commands but they are no longer displayed
32+
in command listings, so end-users are not aware of their existence.

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