DDC-942: Query getSingleResult throws inappropiate exceptions. #1167

Open
opened 2026-01-22 13:04:32 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 17, 2010).

Jira issue originally created by user henrikbjorn:

Currently when using the Query object or QueryBuilder there is no easy way to get the first found result with doing a lot of work. The method that seems to be for this purpose is getSingleResult but it throws an exception if no records are found and if there is more than one record found another Exception is thrown. This behavior is different than the ODM\MongoDB where null is returned.

Originally created by @doctrinebot on GitHub (Dec 17, 2010). Jira issue originally created by user henrikbjorn: Currently when using the Query object or QueryBuilder there is no easy way to get the first found result with doing a lot of work. The method that seems to be for this purpose is getSingleResult but it throws an exception if no records are found and if there is more than one record found another Exception is thrown. This behavior is different than the ODM\MongoDB where null is returned.
admin added the Bug label 2026-01-22 13:04:32 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1167