mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-29 14:36:22 +00:00
765 B
765 B
id | title |
---|---|
94e8a635-126e-4c26-8176-2020a5e79b26 | Lazy Commands |
Description
From Symfony 4.0 commands are lazily loaded. One broken command won't break all the other commands you have. In order to lazy-load a command do the following:
- Define command as a service
- Add a
command
property to theconsole.command
tag
Syntax
app.command.complex_command:
# ...
tags:
# the value of the 'command' attribute is the name of the command
# (which is what the user needs to type in to execute it)
- { name: console.command, command: app:my-command }
# optionally you can define an alias for the command too
- { name: console.command, command: app:my-command, alias: 'my-shortcut' }