EntityRepository::findOneBy() should throw NonUniqueResultException #6512

Closed
opened 2026-01-22 15:34:20 +01:00 by admin · 1 comment
Owner

Originally created by @KouloukLeGrand on GitHub (Aug 6, 2020).

I have just read that a Query throws a NonUniqueResultException if Query::getOneOrNullResult() or Query::getSingleResult() is called and finds more than one matching result.

Do you think it is feasible? And if not, why?

Originally created by @KouloukLeGrand on GitHub (Aug 6, 2020). I have just read that a Query throws a NonUniqueResultException if Query::getOneOrNullResult() or Query::getSingleResult() is called and finds more than one matching result. Do you think it is feasible? And if not, why?
admin closed this issue 2026-01-22 15:34:20 +01:00
Author
Owner

@beberlei commented on GitHub (Sep 13, 2020):

That is the way we want the API to work, multiple results can lead to the risk of the wrong one being picked without developer noticing.

@beberlei commented on GitHub (Sep 13, 2020): That is the way we want the API to work, multiple results can lead to the risk of the wrong one being picked without developer noticing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6512