From f8718fa4dec3dc1114edbd2c21a6bebd1369c869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 9 Nov 2021 13:55:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ActiveQuery.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ActiveQuery.php b/src/ActiveQuery.php index 07feb65..4e52883 100644 --- a/src/ActiveQuery.php +++ b/src/ActiveQuery.php @@ -237,8 +237,9 @@ class ActiveQuery extends Component implements ISqlBuilder */ public function count(): int { - $this->select = ['COUNT(*)']; - $data = $this->execute($this->builder->count())->one(); + $clone = clone $this; + $clone->select = ['COUNT(*)']; + $data = $this->execute($clone->builder->count())->one(); if ($data && is_array($data)) { return (int)array_shift($data); }