Pagine la liste des news récentes
This commit is contained in:
@@ -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;');
|
||||
|
Reference in New Issue
Block a user