DDC-1347: Github-PR-110 by shesek: Support NULL in EntityRepository's magic findBy and findOneBy methods #1691

Closed
opened 2026-01-22 13:22:19 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 25, 2011).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user @beberlei:

This issue is created automatically through a Github pull request on behalf of {username}:

Url: https://github.com/doctrine/doctrine2/pull/110

Message:

The magic findBy and findOneBy methods don't support passing NULL as the value, because "we cannot (yet) transform it into IS NULL".

However, BasicEntityPersister::_getSelectConditionSQL() does support that. It seems like leftovers from when there was no support for it. I tried it locally (after applying this change) and it does seem to work well.

Originally created by @doctrinebot on GitHub (Aug 25, 2011). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user @beberlei: This issue is created automatically through a Github pull request on behalf of {username}: Url: https://github.com/doctrine/doctrine2/pull/110 Message: The magic `findBy` and `findOneBy` methods don't support passing NULL as the value, because ["we cannot (yet) transform it into IS NULL"](https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/EntityRepository.php#L207). However, `BasicEntityPersister::_getSelectConditionSQL()` [does support that](https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php#L1229). It seems like leftovers from when there was no support for it. I tried it locally (after applying this change) and it does seem to work well.
admin added the ImprovementDuplicate labels 2026-01-22 13:22:19 +01:00
admin closed this issue 2026-01-22 13:22:19 +01:00
Author
Owner

@malukenho commented on GitHub (Jan 5, 2017):

@Ocramius can be closed as it would cause BC break

@malukenho commented on GitHub (Jan 5, 2017): @Ocramius can be closed as it would cause BC break
Author
Owner

@lcobucci commented on GitHub (Jan 5, 2017):

I think it was already solved on #153

@lcobucci commented on GitHub (Jan 5, 2017): I think it was already solved on #153
Author
Owner

@kimhemsoe commented on GitHub (Jan 5, 2017):

We do support findby(["name" => null]) today. If i remember correct we got the support in 2.5

@kimhemsoe commented on GitHub (Jan 5, 2017): We do support findby(["name" => null]) today. If i remember correct we got the support in 2.5
Author
Owner

@Ocramius commented on GitHub (Jan 5, 2017):

Indeed, closing as dupe.

@Ocramius commented on GitHub (Jan 5, 2017): Indeed, closing as dupe.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1691