diff options
author | Thomas Lange <code@nerdmind.de> | 2021-06-27 22:00:46 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-06-27 22:01:20 +0200 |
commit | 02e306b1ebf6d9d60f4d89370430f8ca2b9f6c77 (patch) | |
tree | 0a948edffc9a2fc4db44a7aa870d9e15eaa0af33 /core | |
parent | 8dedd695ce966b5cb968e116d7418665e184467d (diff) | |
download | blog-02e306b1ebf6d9d60f4d89370430f8ca2b9f6c77.tar.gz blog-02e306b1ebf6d9d60f4d89370430f8ca2b9f6c77.tar.xz blog-02e306b1ebf6d9d60f4d89370430f8ca2b9f6c77.zip |
Allow NULL value comparison in WHERE clause
Diffstat (limited to 'core')
-rw-r--r-- | core/namespace/ORM/Repository.php | 8 |
1 files changed, 6 insertions, 2 deletions
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); |