From 02e306b1ebf6d9d60f4d89370430f8ca2b9f6c77 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sun, 27 Jun 2021 22:00:46 +0200 Subject: Allow NULL value comparison in WHERE clause --- core/namespace/ORM/Repository.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'core/namespace/ORM') diff --git a/core/namespace/ORM/Repository.php b/core/namespace/ORM/Repository.php index 868a60b..58ccf97 100644 --- a/core/namespace/ORM/Repository.php +++ b/core/namespace/ORM/Repository.php @@ -207,8 +207,12 @@ abstract class Repository { if(!empty($filter)) { foreach($filter as $column => $value) { - $wheres[] = "$column = ?"; - $params[] = $value; + if($value === NULL) { + $wheres[] = "$column IS NULL"; + } else { + $wheres[] = "$column = ?"; + $params[] = $value; + } } $where = 'WHERE '.implode(' AND ', $wheres); -- cgit v1.2.3