[FEATURE] Add configuration options to FloatConverter
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / master / Feature-75827-AddConfigurationOptionsToFloatConverter.rst
1 =======================================================================================================
2 Feature: #75827 - Add configuration options to \TYPO3\CMS\Extbase\Property\TypeConverter\FloatConverter
3 =======================================================================================================
4
5 Description
6 ===========
7
8 It is now possible to define thousand separator and decimal point for FloatConverter.
9 This can be used to ensure proper sanitation before converting a string to a float.
10
11 You can define the configuration for every property like this:
12
13 .. code-block:: php
14
15 $this->arguments['<argumentName>']
16 ->getPropertyMappingConfiguration()
17 ->forProperty('<propertyName>') // this line can be skipped in order to specify the format for all properties
18 ->setTypeConverterOption(
19 \TYPO3\CMS\Extbase\Property\TypeConverter\FloatConverter::class,
20 \TYPO3\CMS\Extbase\Property\TypeConverter\FloatConverter::CONFIGURATION_THOUSANDS_SEPARATOR,
21 '.'
22 )
23 ->setTypeConverterOption(
24 \TYPO3\CMS\Extbase\Property\TypeConverter\FloatConverter::class,
25 \TYPO3\CMS\Extbase\Property\TypeConverter\FloatConverter::CONFIGURATION_DECIMAL_POINT,
26 ','
27 );