From 3a39eaabf41ec821d5e867b35cfa9956adc5392c Mon Sep 17 00:00:00 2001 From: whwyy Date: Fri, 26 Apr 2024 15:25:12 +0800 Subject: [PATCH] eee --- ActiveQuery.php | 4 +--- SqlBuilder.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ActiveQuery.php b/ActiveQuery.php index 07b142e..fac0ac6 100644 --- a/ActiveQuery.php +++ b/ActiveQuery.php @@ -154,9 +154,7 @@ class ActiveQuery extends QueryTrait implements ISqlBuilder */ public function count(): int { - $clone = clone $this; - $clone->select(['count(*)']); - $search = $clone->buildCommand($clone->builder->count())->one(); + $search = $this->buildCommand($this->builder->count())->one(); return !$search ? 0 : current($search); } diff --git a/SqlBuilder.php b/SqlBuilder.php index bb3fae2..294333f 100644 --- a/SqlBuilder.php +++ b/SqlBuilder.php @@ -235,7 +235,7 @@ class SqlBuilder extends Component */ public function count(): string { - return $this->makeSelect($this->query->select) . $this->make(); + return $this->makeSelect(['COUNT(*)']) . $this->make(); }