Skip to content

Commit b02c3c7

Browse files
committed
minor #10460 Teach the user to write the command lazy loading (SimonHeimberg)
This PR was submitted for the 4.1 branch but it was squashed and merged into the 3.4 branch instead (closes #10460). Discussion ---------- Teach the user to write the command lazy loading A lazy loaded command is instantiated only when it is called. Commits ------- 4706701 Teach the user to write the command lazy loading
2 parents 9827fea + 4706701 commit b02c3c7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

console.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ For example, you may want a command to create a user::
2727

2828
class CreateUserCommand extends Command
2929
{
30+
// the name of the command (the part after "bin/console")
31+
protected static $defaultName = 'app:create-user';
32+
3033
protected function configure()
3134
{
3235
// ...
@@ -49,9 +52,6 @@ method. Then you can optionally define a help message and the
4952
protected function configure()
5053
{
5154
$this
52-
// the name of the command (the part after "bin/console")
53-
->setName('app:create-user')
54-
5555
// the short description shown while running "php bin/console list"
5656
->setDescription('Creates a new user.')
5757

0 commit comments

Comments
 (0)