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

Type infering not working for getSingleScalarResult nor getSingleResult(Query::HYDRATE_SINGLE_SCALAR) #276

Closed
janedbal opened this issue Jan 31, 2022 · 4 comments

Comments

@janedbal
Copy link
Contributor

getOneOrNullResult() and getSingleResult() are supported, but only when explicitly specifying the hydration mode

It was stated here that this should be supported, but it seems like the inferred type is mixed. Or did I misunderstood?

$query = $em->createQueryBuilder()
	->addSelect('m.id')
	->from(Many::class, 'm');

assertType(
	'int',
	$query->getQuery()
		// ->getSingleScalarResult()
		->getSingleResult(Query::HYDRATE_SINGLE_SCALAR)
);

Method getSingleColumnResult seems to be not supported as well, is that correct?

cc @arnaud-lb

@arnaud-lb
Copy link
Contributor

Hi @janedbal

getOneOrNullResult() and getSingleResult() are supported, but only when explicitly specifying the hydration mode

Here I meant when explicitly specifying the hydration mode to HYDRATE_OBJECT

Method getSingleColumnResult seems to be not supported as well, is that correct?

Yes, getSingleColumnResult is not supported currently. I don't think that it can be supported until we support multiple hydration modes.

@janedbal
Copy link
Contributor Author

janedbal commented Feb 1, 2022

Thanks for response, do you plan to add support for more hydration modes?

@janedbal
Copy link
Contributor Author

Assuming not. Closing.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants