Bug #99186
openFormEditor issue if 'type' property in YAML has to be defined as array (ex: for mapping a field called type)
0%
Description
Hello,
I use the saveToDatabase finisher in a form where I need to map a field called 'type'.
... finishers: - identifier: SaveToDatabaseIfMember options: - table: tx_news_domain_model_news ... ... databaseColumnMappings: pid: value: 24 type: value: MyVendor\MyExtension\Domain\Model\MyEvent
The form works fine in frontend but if I open it in backend:
(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception PHP Warning: array_key_exists(): The first argument should be either a string or an integer in /var/www/MyTypo3/typo3/public/typo3/sysext/form/Classes/Controller/FormEditorController.php line 580
The problem is that in transformFormDefinitionForFormEditor() there are 2 calls to transformMultiValuePropertiesForFormEditor() to parse/transform 'type' and 'identifier' properties.
Unfortunately, in my case, 'type' is also a field in tx_news_domain_model_news and has to be defined as an array:
databaseColumnMappings: ... type: value: MyVendor\MyExtension\Domain\Model\MyEvent ...So modifying form/Classes/Controller/FormEditorController.php line 580 :
if (array_key_exists($identifier, $multiValueProperties)) {
$multiValuePropertiesForIdentifier = $multiValueProperties[$identifier];
to
if ((!is_array($identifier)) && array_key_exists($identifier, $multiValueProperties)) {
$multiValuePropertiesForIdentifier = $multiValueProperties[$identifier];
solves the problem. No side effect for the moment with the FormEditor.
No data to display