Skip to content

Fix return type of QueryInterface::execute() #163

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

Merged
merged 1 commit into from
Mar 28, 2025

Conversation

sascha-egerer
Copy link
Owner

@sascha-egerer sascha-egerer commented May 22, 2024

The execute method has a boolean argument that
defines if a raw result should be returned.
This means that no object mapping is done but
an array containing the result values is returned.

It is now also supported to not just pass constant boolean values but a variable containing a boolean to the execute function. In this case it's not clear if a raw result or objects should be returned
so we do now return a union type containing both.

@sascha-egerer sascha-egerer force-pushed the bugfix/fix-query-execute-return-type branch 2 times, most recently from 5bd227d to 82579a4 Compare May 22, 2024 14:37
@@ -6,12 +6,6 @@ namespace TYPO3\CMS\Extbase\Persistence;
*/
interface QueryInterface
{
/**
* @param bool $returnRawQueryResult
* @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface<ModelType>|array<string, mixed>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have now updated the second type to be a list: b56227c

Do we then need changes to the DynamicReturnTypeExtension in this PR?

The `execute()` method has a boolean argument that
defines if a raw result should be returned.
This means that no object mapping is done but
an array containing the result values is returned.

It is now also supported to not just pass constant
boolean values but a variable containing a boolean
to the execute function. In this case it's not clear
if a raw result or objects should be returned
so we do now return a union type containing both.
@sascha-egerer sascha-egerer force-pushed the bugfix/fix-query-execute-return-type branch from 82579a4 to 61cdb6d Compare March 28, 2025 10:58
@sascha-egerer
Copy link
Owner Author

As far as i can see this works now without any fruther changes. I'll merge this one now as it only adds additional tests.

@sascha-egerer sascha-egerer merged commit c6c2a90 into main Mar 28, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants