[PR #110] [MERGED] Support NULL in EntityRepository's magic findBy and findOneBy methods #7720

Closed
opened 2026-01-22 15:56:32 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/110
Author: @shesek
Created: 8/25/2011
Status: Merged
Merged: 10/17/2011
Merged by: @beberlei

Base: masterHead: patch-1


📝 Commits (3)

  • d314386 we can (now) transform it into IS NULL
  • 5fc6277 Oops, shouldn't have removed the condition completely... checking a parameter is provided
  • 2e389e0 Removed blank line, used empty() instead of the count() check

📊 Changes

1 file changed (+1 additions, -2 deletions)

View changed files

📝 lib/Doctrine/ORM/EntityRepository.php (+1 -2)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/110 **Author:** [@shesek](https://github.com/shesek) **Created:** 8/25/2011 **Status:** ✅ Merged **Merged:** 10/17/2011 **Merged by:** [@beberlei](https://github.com/beberlei) **Base:** `master` ← **Head:** `patch-1` --- ### 📝 Commits (3) - [`d314386`](https://github.com/doctrine/orm/commit/d3143860609b37aa628e6434af73f812cbeec188) we can (now) transform it into IS NULL - [`5fc6277`](https://github.com/doctrine/orm/commit/5fc6277d3f2b469eb2e4260f7cb6aa0665287009) Oops, shouldn't have removed the condition completely... checking a parameter is provided - [`2e389e0`](https://github.com/doctrine/orm/commit/2e389e00d40dd68462ca170ac6ee3942297b412c) Removed blank line, used empty() instead of the count() check ### 📊 Changes **1 file changed** (+1 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/EntityRepository.php` (+1 -2) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 15:56:32 +01:00
admin closed this issue 2026-01-22 15:56:33 +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#7720