diff --git a/composer.json b/composer.json index 16ee6048..d291bd31 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "topthink/think-orm", + "name": "watsonhaw/think-orm", "description": "the PHP Database&ORM Framework", "keywords": [ "orm", diff --git a/src/db/concern/WhereQuery.php b/src/db/concern/WhereQuery.php index 3eaae5b0..be976c7e 100644 --- a/src/db/concern/WhereQuery.php +++ b/src/db/concern/WhereQuery.php @@ -310,7 +310,7 @@ public function whereJsonContains(string $field, $condition, string $logic = 'AN $field = 'json_extract(' . $field1 . ',\'$.' . $field2 . '\')'; } - $value = is_string($condition) ? '"' . $condition . '"' : $condition; + $value = is_array($condition) ? json_encode($condition) : (is_string($condition) ? '"' . $condition . '"' : $condition); $name = $this->bindValue($value); $bind[$name] = $value; return $this->whereRaw('json_contains(' . $field . ',:' . $name . ')', $bind, $logic); @@ -590,7 +590,7 @@ protected function parseArrayWhereItems(array $field, string $logic) if (!empty($where)) { $this->options['where'][$logic] = isset($this->options['where'][$logic]) ? - array_merge($this->options['where'][$logic], $where) : $where; + array_merge($this->options['where'][$logic], $where) : $where; } return $this; @@ -653,4 +653,4 @@ protected function executeQuery(Closure | array $query, $condition): void $this->where($query); } } -} +} \ No newline at end of file