From 1b65f8496287e4bcbf3dc0908903b3bef9f3caf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 17 Apr 2023 10:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Traits/QueryTrait.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Traits/QueryTrait.php b/Traits/QueryTrait.php index e03cac6..2ad1037 100644 --- a/Traits/QueryTrait.php +++ b/Traits/QueryTrait.php @@ -767,6 +767,9 @@ trait QueryTrait $this->where[] = $column; } else { [$column, $opera, $value] = $this->opera(...func_get_args()); + if ($value === null) { + return $this; + } $this->bindParam(':' . $column, $value); $this->where[] = $column . ' ' . $opera . ':' . $column; } @@ -854,6 +857,9 @@ trait QueryTrait private function addArray(array $array): static { foreach ($array as $key => $value) { + if ($value === null) { + continue; + } $this->where[] = $this->sprintf($key, $value); } return $this;