aboutsummaryrefslogtreecommitdiffstats
path: root/core/namespace/ORM/Repositories/Page.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-06-25 22:13:59 +0200
committerThomas Lange <code@nerdmind.de>2021-06-25 22:13:59 +0200
commita86bdc6b5bab78b4026f44161413f4e482df42e4 (patch)
tree76ffd745780671371272e97b3eeac85e154e236e /core/namespace/ORM/Repositories/Page.php
parent366d0de19c012821ef587d5fdb9557c339b43303 (diff)
downloadblog-a86bdc6b5bab78b4026f44161413f4e482df42e4.tar.gz
blog-a86bdc6b5bab78b4026f44161413f4e482df42e4.tar.xz
blog-a86bdc6b5bab78b4026f44161413f4e482df42e4.zip
Reorganize namespaces
Diffstat (limited to 'core/namespace/ORM/Repositories/Page.php')
-rw-r--r--core/namespace/ORM/Repositories/Page.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/namespace/ORM/Repositories/Page.php b/core/namespace/ORM/Repositories/Page.php
new file mode 100644
index 0000000..595b420
--- /dev/null
+++ b/core/namespace/ORM/Repositories/Page.php
@@ -0,0 +1,19 @@
+<?php
+namespace ORM\Repositories;
+use ORM\Repository;
+use ORM\Entities\User;
+
+class Page extends Repository {
+ public static function getTableName(): string { return 'page'; }
+ public static function getClassName(): string { return 'ORM\Entities\Page'; }
+
+ 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();
+ }
+}