This commit is contained in:
2021-11-09 13:55:32 +08:00
parent ffae51bccf
commit f8718fa4de
+3 -2
View File
@@ -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);
}