Pagine la liste des news récentes

This commit is contained in:
clement committed 2022-11-30 10:49:10 +01:00
1 parent 9519287329
commit 2c8e49e560
5 files changed
+79 -6

No files matched your search

+9
View File
@@ -37,6 +37,15 @@ class NewsGateway
return $news;
}
public function getCount(): int
{
$req = $this->pdo->query('SELECT COUNT(*) nb FROM news;');
if ($req === false) {
return 0;
}
return intval($req->fetch()['nb']);
}
public function getById(int $id): News
{
$req = $this->pdo->prepare('SELECT * FROM news WHERE id_news=:id;');