Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb08bbd0

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 commandsThis documentssymfony/symfony#20029.Commits-------d1cb043 Reflect private to hidden renaming in the file name01f474f Reflect renaming from private to hidden9415643 Added an article about private console commands
2 parents5eb2eeb +d1cb043 commitb08bbd0

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)

[8]ページ先頭

©2009-2025 Movatter.jp