aboutsummaryrefslogtreecommitdiffstats
path: root/core/namespace/ORM/Repositories/Page.php
blob: 595b4208c3efcf7e6e502898d281eda6229d2938 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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();
	}
}