aboutsummaryrefslogtreecommitdiffstats
path: root/core/namespace/Page/Repository.php
blob: b76ef8512627e5f15756a20bbbc0e2647c73b55c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
namespace Page;

class Repository extends \Repository {
	public static function getTableName(): string { return 'page'; }
	public static function getClassName(): string { return 'Page\Entity'; }

	public function getCountByUser(\User\Entity $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();
	}
}