From 733102b4a109c0bb8ca026b1dbbadaa9bb62ae70 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Thu, 3 Apr 2014 17:17:58 +0200 Subject: [PATCH] DDC-3065 - applying hotfix that allows `NULL` in `IN()` criteria --- lib/Doctrine/ORM/Persisters/BasicEntityPersister.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php index 6504a3ee0..6fc1f9966 100644 --- a/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php +++ b/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php @@ -1534,7 +1534,13 @@ class BasicEntityPersister implements EntityPersister } if (is_array($value)) { - return sprintf('%s IN (%s)' , $condition, $placeholder); + $in = sprintf('%s IN (%s)' , $condition, $placeholder); + + if (false !== array_search(null, $value, true)) { + return sprintf('(%s OR %s IS NULL)' , $in, $condition); + } + + return $in; } if ($value === null) {