Deprecation: #89139 - Console Commands configuration format Commands.php

See forge#89139

Description

The console command configuration file format Configuration/Commands.php has been marked as deprecated in favor of the symfony service tag console.command. The tag allows to configure dependency injection and command registration in one single location.

Impact

Providing a command configuration in Configuration/Commands.php will trigger a PHP E_USER_DEPRECATED error when the respective commands have not already been defined via symfony service tags.

Extensions that provide both, the deprecated configuration file and service tags, will not trigger a PHP E_USER_DEPRECATED error in order to allow extensions to support multiple TYPO3 major versions.

Affected Installations

TYPO3 installations with custom extensions that configure symfony console commands via Configuration/Commands.php and have not been migrated to add symfony service tags.

Migration

Add the console.command tag to command classes. Use the tag attribute command to specify the command name. The optional tag attribute schedulable may be set to false to exclude the command from the TYPO3 scheduler.

services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  MyVendor\MyExt\Command\FooCommand:
    tags:
      - name: 'console.command'
        command: 'my:command'
        schedulable: false

Command aliases are to be configured as separate tags. The optional tag attribute alias should be set to true for alias commands.

MyVendor\MyExt\Command\BarCommand:
  tags:
    - name: 'console.command'
      command: 'my:bar'
    - name: 'console.command'
      command: 'my:old-bar-command'
      alias: true
      schedulable: false