Skip to content

Commit

Permalink
修正where方法为空的处理
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Dec 5, 2024
1 parent d878b90 commit 15255d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/db/concern/WhereQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function where($field, $op = null, $condition = null)
} elseif (true === $field || 1 === $field) {
$this->options['where']['AND'][] = true;

return $this;
} elseif (empty($field)) {
return $this;
}

Expand Down Expand Up @@ -96,7 +98,7 @@ public function whereOr($field, $op = null, $condition = null)
$param = func_get_args();
array_shift($param);

if (is_array($field)) {
if (is_array($field) && !empty($field)) {
return $this->where(function ($query) use ($param, $condition, $op, $field) {
return $query->parseWhereExp('OR', $field, $op, $condition, $param);
});
Expand All @@ -119,7 +121,7 @@ public function whereXor($field, $op = null, $condition = null)
$param = func_get_args();
array_shift($param);

if (is_array($field)) {
if (is_array($field) && !empty($field)) {
return $this->where(function ($query) use ($param, $condition, $op, $field) {
return $query->parseWhereExp('XOR', $field, $op, $condition, $param);
});
Expand Down

0 comments on commit 15255d6

Please sign in to comment.