This commit is contained in:
2024-12-13 14:44:00 +08:00
parent 0cc1d3d9f7
commit 7ea245fc89
2 changed files with 16 additions and 2 deletions
+15 -1
View File
@@ -40,7 +40,7 @@ abstract class QueryTrait extends Component implements ActiveQueryInterface, ISq
protected bool $lock = FALSE;
protected SqlBuilder $builder;
protected array $params = [];
protected array $_alias = ['t1.*'];
protected array $_alias = [];
/**
@@ -74,6 +74,20 @@ abstract class QueryTrait extends Component implements ActiveQueryInterface, ISq
}
public function whereNotExists(Closure|string $callback, array $attributes = []): static
{
if (is_string($callback)) {
$this->where[] = $callback;
} else {
$this->where[] = 'NOT EXISTS(' . $this->makeClosureFunction($callback) . ')';
}
if (count($attributes) > 0) {
$this->bindParams($attributes);
}
return $this;
}
/**
* @param array $select
*