mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-29 14:36:22 +00:00
28 lines
765 B
Markdown
28 lines
765 B
Markdown
|
---
|
||
|
id: 94e8a635-126e-4c26-8176-2020a5e79b26
|
||
|
title: Lazy Commands
|
||
|
---
|
||
|
|
||
|
# Description
|
||
|
|
||
|
From [Symfony 4.0](20201109140137-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 the `console.command` tag
|
||
|
|
||
|
# Syntax
|
||
|
|
||
|
``` yaml
|
||
|
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' }
|
||
|
```
|