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_
file and adding the configuration, such as the source
, the target
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.
file by tagging the service
with extbase.
and adding the configuration as tag
attributes.
This means, the registration via php:\TYPO3\
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.
like the following:
services:
Vendor\Extension\Property\TypeConverter\MyBooleanConverter:
tags:
- name: extbase.type_converter
priority: 10
target: boolean
sources: boolean,string
Tip
Tag arguments (priority, target, sources, etc.) have to be simple types. Don't register the sources as array but as comma separated list as shown in the example.
Note
Since the configuration (priority, target and sources) are now done at this place, respective type converter properties are now superfluous and will also no longer be evaluated. See the deprecation changelog for more information.