Deprecation-89139-ConsoleCommandsConfigurationFormatCommandsPhp.rst 2.19 KB
Newer Older
1
2
.. include:: ../../Includes.txt

3
4
5
========================================================================
Deprecation: #89139 - Console Commands configuration format Commands.php
========================================================================
6
7
8
9
10
11
12

See :issue:`89139`

Description
===========

The console command configuration file format :php:`Configuration/Commands.php`
13
14
has been marked as deprecated in favor of the symfony service tag
:yaml:`console.command`. The tag allows to configure dependency injection and
15
16
17
18
19
20
21
command registration in one single location.


Impact
======

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

Extensions that provide both, the deprecated configuration file and service
26
tags, will not trigger a PHP :php:`E_USER_DEPRECATED` error in order to allow extensions to
27
28
29
30
31
32
33
34
35
36
37
38
39
40
support multiple TYPO3 major versions.


Affected Installations
======================

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


Migration
=========

41
42
Add the :yaml:`console.command` tag to command classes. Use the tag attribute :yaml:`command`
to specify the command name. The optional tag attribute :yaml:`schedulable` may be set
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
to false to exclude the command from the TYPO3 scheduler.

.. code-block:: yaml

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

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

Command aliases are to be configured as separate tags.
60
The optional tag attribute :yaml:`alias` should be set to true for alias commands.
61
62
63
64
65
66

.. code-block:: yaml

      MyVendor\MyExt\Commands\BarCommand
        tags:
          - name: 'console.command'
67
            command: 'my:bar'
68
69
70
71
72
73
          - name: 'console.command'
            command: 'my:old-bar-command'
            alias: true
            schedulable: false

.. index:: CLI, PHP-API, PartiallyScanned, ext:core