This commit is contained in:
2021-08-09 18:51:49 +08:00
parent df9e8eb0c5
commit 415abed013
2 changed files with 15 additions and 1 deletions
+11 -1
View File
@@ -44,6 +44,17 @@ class SqlBuilder extends Component
}
/**
* @param array $compiler
* @return string
* @throws Exception
*/
public function hashCompiler(array $compiler): string
{
return $this->where($compiler);
}
/**
* @param array $attributes
* @return bool|array
@@ -97,7 +108,6 @@ class SqlBuilder extends Component
}
/**
* @param array $attributes
* @param false $isBatch
+4
View File
@@ -816,12 +816,16 @@ trait QueryTrait
* @return $this
* @throws NotFindClassException
* @throws ReflectionException
* @throws Exception
*/
public function where(Closure|array $conditions): static
{
if ($conditions instanceof Closure) {
$conditions = $this->makeClosureFunction($conditions);
}
if (is_array($conditions)) {
$conditions = $this->builder->hashCompiler($conditions);
}
$this->where[] = $conditions;
return $this;
}