With version 4.2.2 of TYPO3 Headless API it works in a typoscript file with a content processor (FriendsOfTYPO3\Headless\DataProcessing\DatabaseQueryProcessor)
selectFields = exttensiontable.* now you get all fields of the table without explicitly setting
fields {
uid = TEXT
uid {
field = uid
}
}
Now we have updated to the current version 4.2.7 and have now encountered the problem that fields must be specified as otherwise an error appears
TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor::process(): Argument #3 ($variables) must be of type array, null given, called in headless/Classes/DataProcessing/DatabaseQueryProcessor.php on line 128
This line occurs to be the problem:
$processedRecordVariables[$key] = \json_decode($recordContentObjectRenderer->cObjGetSingle($objName, $objConf), true);
if fields is empty then $objConf is also empty and the error appears in the next line cause
$processedRecordVariables[$key] is null but needs to be a array with values
We have encountered a problem.
With version 4.2.2 of TYPO3 Headless API it works in a typoscript file with a content processor (FriendsOfTYPO3\Headless\DataProcessing\DatabaseQueryProcessor) selectFields = exttensiontable.* now you get all fields of the table without explicitly setting fields { uid = TEXT uid { field = uid } }
Now we have updated to the current version 4.2.7 and have now encountered the problem that fields must be specified as otherwise an error appears TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor::process(): Argument #3 ($variables) must be of type array, null given, called in headless/Classes/DataProcessing/DatabaseQueryProcessor.php on line 128
Now we have looked at the processor and noticed that the functionality has been changed at https://github.com/TYPO3-Headless/headless/commit/49c24f3d726209c210bceb182ad67e36bba9d495
This line occurs to be the problem: $processedRecordVariables[$key] = \json_decode($recordContentObjectRenderer->cObjGetSingle($objName, $objConf), true);
if fields is empty then $objConf is also empty and the error appears in the next line cause
$processedRecordVariables[$key] is null but needs to be a array with values
$processedRecordVariables[$key] = $this->contentDataProcessor->process($recordContentObjectRenderer, $processorConfiguration, $processedRecordVariables[$key]);
Our quick hack is to check if $objConf has values, than use the new version and otherwise use the $record like in the old version
$processedRecordVariables[$key] =count($objConf) ? \json_decode($recordContentObjectRenderer->cObjGetSingle($objName, $objConf), true) : $record
so the old logic is reused only differently.