fix(repositories): make db queries use count

This should fix /about page
This commit is contained in:
Alexander Minkin 2023-12-10 21:55:28 +03:00
parent b2b6fe6966
commit 88d296a9c4
Signed by untrusted user: WerySkok
GPG key ID: 88E9A2F3AFE44C30
3 changed files with 5 additions and 5 deletions

View file

@ -53,7 +53,7 @@ class Clubs
function getCount(): int function getCount(): int
{ {
return sizeof(clone $this->clubs); return (clone $this->clubs)->count('*');
} }
function getPopularClubs(): \Traversable function getPopularClubs(): \Traversable

View file

@ -252,6 +252,6 @@ class Posts
function getCount(): int function getCount(): int
{ {
return sizeof(clone $this->posts); return (clone $this->posts)->count('*');
} }
} }

View file

@ -142,9 +142,9 @@ class Users
function getStatistics(): object function getStatistics(): object
{ {
return (object) [ return (object) [
"all" => sizeof(clone $this->users), "all" => (clone $this->users)->count('*'),
"active" => sizeof((clone $this->users)->where("online > 0")), "active" => (clone $this->users)->where("online > 0")->count('*'),
"online" => sizeof((clone $this->users)->where("online >= ?", time() - 900)), "online" => (clone $this->users)->where("online >= ?", time() - 900)->count('*'),
]; ];
} }