Closed
Description
It may be possible to infer the return type of execute(), getResult(), etc on Query instances when the query string is known statically.
This could be implemented like this:
- Override the Query and AbstractQuery classes so that they have a type parameter, representing the type of their results (e.g. a
Query
returningUser
objects would be aQuery<User>
) - Add a return type extension for EntityManagerInterface::createQuery(), to infer the result type from the query string, and so that we can tel that createQuery() returns a
Query<something>
The ResultSetMapper of a Query provides enough info to infer the result type in the most simple cases (e.g. SELECT u FROM User
). This would already be super useful. Other cases might require a custom SqlWalker because the ResultSetMapper doesn't provide any information on nullability, for example.
Metadata
Metadata
Assignees
Labels
No labels