This commit is contained in:
2024-04-26 15:22:16 +08:00
parent 4341efcb8c
commit f9ee3aa014
+3 -1
View File
@@ -154,7 +154,9 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder
*/
public function count(): int
{
$search = $this->buildCommand((clone $this)->select(['count(*)'])->builder->count())->one();
$clone = clone $this;
$clone->select(['count(*)']);
$search = $clone->buildCommand($clone->builder->count())->one();
return !$search ? 0 : current($search);
}