From da5ed786a83e5a1e10c8cc3a8b8142364af534a3 Mon Sep 17 00:00:00 2001 From: brongniart Date: Wed, 27 Nov 2024 09:34:33 +0100 Subject: [PATCH] modif getQuoteOfTheDay --- src/Gateway/QuoteGateway.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Gateway/QuoteGateway.php b/src/Gateway/QuoteGateway.php index 60bac0f..c6bdc91 100644 --- a/src/Gateway/QuoteGateway.php +++ b/src/Gateway/QuoteGateway.php @@ -69,12 +69,14 @@ Class QuoteGateway extends Gateway{ public function getQuoteOfTheDay(string $language): array { $query = "SELECT q.id_quote, q.content, c.caracter, i.imgPath, s.title, s.dateS, q.likes, q.langue - FROM Quote q - JOIN Caracter c ON c.id_caracter = q.id_caracter - JOIN Source s ON s.id_source = q.id_source - JOIN Image i ON c.id_img = i.id_img - WHERE q.isValide = true AND q.isCitationDuJour = true AND q.langue = :language - ORDER BY id_quote DESC LIMIT 1;"; + FROM DailyQuote dq + JOIN Quote q ON dq.citation_id = q.id_quote + JOIN Caracter c ON c.id_caracter = q.id_caracter + JOIN Source s ON s.id_source = q.id_source + JOIN Image i ON c.id_img = i.id_img + WHERE q.isValide = true AND q.langue = :language + ORDER BY q.id_quote DESC + LIMIT 1;"; try { $this->co->executeQuery($query, [':language' => [$language, PDO::PARAM_STR]]); $result = $this->co->getResults(); @@ -83,7 +85,8 @@ Class QuoteGateway extends Gateway{ echo "Erreur dans getQuoteOfTheDay: " . $e->getMessage(); return []; } - } + } + public function getSuggestions(int $numpage, string $language): array {