改名
This commit is contained in:
@@ -737,7 +737,7 @@ trait QueryTrait
|
|||||||
*/
|
*/
|
||||||
public function makeNewSqlGenerate(): Query
|
public function makeNewSqlGenerate(): Query
|
||||||
{
|
{
|
||||||
return Snowflake::createObject(Query::class);
|
return Snowflake::createObject(['class' => Query::class]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -804,12 +804,12 @@ trait QueryTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param callable|array $conditions
|
* @param Closure|array $conditions
|
||||||
* @return $this
|
* @return $this
|
||||||
* @throws NotFindClassException
|
* @throws NotFindClassException
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public function where(callable|array $conditions): static
|
public function where(Closure|array $conditions): static
|
||||||
{
|
{
|
||||||
if ($conditions instanceof Closure) {
|
if ($conditions instanceof Closure) {
|
||||||
$conditions = $this->makeClosureFunction($conditions);
|
$conditions = $this->makeClosureFunction($conditions);
|
||||||
|
|||||||
@@ -39,18 +39,14 @@ class When
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array|\Closure $condition
|
* @param string|int $condition
|
||||||
* @param string $then
|
* @param string $then
|
||||||
* @return $this
|
* @return $this
|
||||||
* @throws \ReflectionException
|
|
||||||
* @throws NotFindClassException
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function when(array|\Closure $condition, string $then): static
|
public function when(string|int $condition, string $then): static
|
||||||
{
|
{
|
||||||
$this->_condition[] = sprintf('WHEN %s THEN %s', $this->activeQuery->makeNewSqlGenerate()
|
$this->_condition[] = sprintf('WHEN %s THEN %s', $condition, $then);
|
||||||
->where($condition)
|
|
||||||
->getCondition(), $then);
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user