headless
headless copied to clipboard
Data with $processorConfiguration option 'returnFlattenObject'==1 should also be returned under $targetVariableName
When using DatabaseQueryProcessor with returnFlattenObject=1 (only 1 record item expected on output instead of array of records), this method returns data without the $targetVariableName key specified via 'as' option
return array_shift($processedRecordVariables);
while when returnFlattenObject is not set, the method returns the data under the $targetVariableName key
[ $targetVariableName => $processedRecordVariables; ]
Issue in file: https://github.com/TYPO3-Headless/headless/blob/c133e52db4ed55fadc125a5a0b78fa11276afb5f/Classes/DataProcessing/DatabaseQueryProcessor.php#L126
This could be resolved by changing the line 126 to something like
$processedRecordVariables = $processedRecordVariables[0] ?? [];
without returning it and letting the line 132 to return the whole $processedData as usual - with the data appended under the $targetVariableName key on line 130.
Thanks for checking.