aboutsummaryrefslogtreecommitdiffstats
path: root/core/namespace
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-06-27 22:00:46 +0200
committerThomas Lange <code@nerdmind.de>2021-06-27 22:01:20 +0200
commit02e306b1ebf6d9d60f4d89370430f8ca2b9f6c77 (patch)
tree0a948edffc9a2fc4db44a7aa870d9e15eaa0af33 /core/namespace
parent8dedd695ce966b5cb968e116d7418665e184467d (diff)
downloadblog-02e306b1ebf6d9d60f4d89370430f8ca2b9f6c77.tar.gz
blog-02e306b1ebf6d9d60f4d89370430f8ca2b9f6c77.tar.xz
blog-02e306b1ebf6d9d60f4d89370430f8ca2b9f6c77.zip
Allow NULL value comparison in WHERE clause
Diffstat (limited to 'core/namespace')
-rw-r--r--core/namespace/ORM/Repository.php8
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);