Feature: #94117 - Improve Extbase type converter registration

See forge#94117

Description

Extbase type converters are an important part of the Extbase data and property mapping mechanism. Those converters usually convert data from simple types to objects or other simple types.

Extension authors can add their own type converters. This was previously done by registering the type converter class in the ext_localconf.php file and adding the configuration, such as the sourceType, the targetType or the priority as class properties, accessible via public methods.

This has now been improved. Type converters are now registered as container services in the extension's Services.yaml file by tagging the service with extbase.type_converter and adding the configuration as tag attributes.

This means, the registration via php:\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerTypeConverter() can be removed together with the configuration related class properties and methods. See changelog for more information.

Impact

Registration is now done in your Services.yaml like the following:

services:
  Vendor\Extension\Property\TypeConverter\MyBooleanConverter:
    tags:
      - name: extbase.type_converter
        priority: 10
        target: boolean
        sources: boolean,string
Copied!