This commit is contained in:
xl
2023-06-12 15:31:45 +08:00
parent 65bbc6888a
commit 5d161fd1e7
5 changed files with 210 additions and 333 deletions
+1 -5
View File
@@ -263,11 +263,7 @@ class ActiveQuery extends Component implements ISqlBuilder
*/
public function count(): int
{
$data = $this->execute($this->builder->count(), $this->attributes)->one();
if ($data && is_array($data)) {
return (int)array_shift($data);
}
return 0;
return $this->execute($this->builder->count(), $this->attributes)->one()['row_count'] ?? 0;
}