diff options
author | Thomas Lange <code@nerdmind.de> | 2021-07-20 00:27:46 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-07-20 00:34:47 +0200 |
commit | 01d4727f939c0b9530fe5fc976b7accb9e078db1 (patch) | |
tree | 2053b57a25ef42cec5c6e79ae837e5a4d0ceb69e /core/namespace/ORM/Repositories/Post.php | |
parent | dd4b3d9ebb85c9bc8138212fd7cb207ab154f626 (diff) | |
download | blog-01d4727f939c0b9530fe5fc976b7accb9e078db1.tar.gz blog-01d4727f939c0b9530fe5fc976b7accb9e078db1.tar.xz blog-01d4727f939c0b9530fe5fc976b7accb9e078db1.zip |
Rename and reorganize several "get count" methods
Diffstat (limited to 'core/namespace/ORM/Repositories/Post.php')
-rw-r--r-- | core/namespace/ORM/Repositories/Post.php | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/core/namespace/ORM/Repositories/Post.php b/core/namespace/ORM/Repositories/Post.php index d6328e6..7f672e5 100644 --- a/core/namespace/ORM/Repositories/Post.php +++ b/core/namespace/ORM/Repositories/Post.php @@ -7,25 +7,4 @@ use ORM\Entities\Category; class Post extends Repository { public static function getTableName(): string { return 'post'; } public static function getClassName(): string { return 'ORM\Entities\Post'; } - - public function getCountByUser(User $User): int { - $query = 'SELECT COUNT(id) FROM %s WHERE user = ?'; - $query = sprintf($query, static::getTableName()); - - $Statement = $this->Database->prepare($query); - $Statement->execute([$User->getID()]); - - return $Statement->fetchColumn(); - } - - # TODO: This only gets the count of the direct category, not its children - public function getCountByCategory(Category $Category): int { - $query = 'SELECT COUNT(id) FROM %s WHERE category = ?'; - $query = sprintf($query, static::getTableName()); - - $Statement = $this->Database->prepare($query); - $Statement->execute([$Category->getID()]); - - return $Statement->fetchColumn(); - } } |