Skip to content

[Console] Always use lazy commands? #8843

Closed
@javiereguiluz

Description

@javiereguiluz

This issue was reported in the Symfony Slack.

  1. A user was reading https://symfony.com/doc/current/console.html
  2. Then he run make:command
  3. He didn't see ->setName('...') in the generated command, so he added ->setName('app:mycommand') himself.
  4. Then he saw this error: ">>>There are no commands defined in the "app:mycommand" namespace"

The problem is:

  1. MakerBundle generates lazy commands by default (https://github.com/symfony/maker-bundle/blob/bf97703ddb68c6b37bd6bab5f5ebd5c7542ca1ef/src/Resources/skeleton/command/Command.tpl.php#L14), as explained in https://symfony.com/doc/3.4/console/commands_as_services.html#lazy-loading
  2. But most of the console docs don't use lazy commands.

What should we do here? Should we change all console docs to always use lazy commands?

Metadata

Metadata

Assignees

Labels

ConsoleactionableClear and specific issues ready for anyone to take them.hasPRA Pull Request has already been submitted for this issue.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions