Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data with $processorConfiguration option 'returnFlattenObject'==1 should also be returned under $targetVariableName #739

Closed
dacko-sk opened this issue Jun 13, 2024 · 0 comments · Fixed by #807

Comments

@dacko-sk
Copy link

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:

return array_shift($processedRecordVariables);

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.

twoldanski added a commit that referenced this issue Feb 13, 2025
…ueryProcessor

Add new flag `returnFlattenLegacy` (enabled by default),
if disabled and combined with `returnFlattenObject`
will return null instead of empty array if no records are found
and will respect "as" setting

Resolves: #797, #739
lukaszuznanski pushed a commit that referenced this issue Feb 21, 2025
…ueryProcessor (#807)

Add new flag `returnFlattenLegacy` (enabled by default),
if disabled and combined with `returnFlattenObject`
will return null instead of empty array if no records are found
and will respect "as" setting

Resolves: #797, #739
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant