Feature: #93174 - Lazy console command list
See forge#93174
Description
The TYPO3 command line utility
typo3/
has been adapted to
avoid instantiating all available console commands during the execution of the
default
typo3 list
command.
This enables commands to inject dependencies that require a fully booted system, or a database connection, without causing the console command list to break or slow down.
Options
New tag properties for the
console.
dependency injection tag
have been added. The properties control the appearance of console commands in the
list output.
- `description`
-
The description of the command (default:
''
). - `hidden`
-
Command will be hidden from
list
iftrue
(default:false
).
Example of a command registration that includes a description
The command list requires the description to be set next to the command
name in Services.
in order for descriptions to be shown:
# Configuration/Services.yaml
services:
My\Namespace\Command\ExampleCommand:
tags:
- name: 'console.command'
command: 'my:example'
description: 'An example command that demonstrates some stuff'
# not required, defaults to false
hidden: false
Migration
Extension authors should add the
description
property to existing
console.
dependency injection tags.
The call to
$this->set
in
Command::
should
be removed, as the description, as defined in Services.
, will be
injected into the command.
Impact
Extensions authors are now able to inject arbitrary dependencies in console commands, without impacting the loading of the command list.
Integrators profit from a stable command list that is fast and always available, even if a command is not instantiable or if it inadvertently contains too much logic inside the command constructor.