From 3c093c5aa14621e199eff51a88b855e4d7d1d876 Mon Sep 17 00:00:00 2001 From: point Date: Mon, 13 Nov 2023 18:51:46 +0100 Subject: [PATCH] :construction: Modif ArticleGateway.php, ajout de la fonction addArticle --- fluxRSS/DAL/ArticleGateway.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fluxRSS/DAL/ArticleGateway.php b/fluxRSS/DAL/ArticleGateway.php index cd0e31f..a36f565 100644 --- a/fluxRSS/DAL/ArticleGateway.php +++ b/fluxRSS/DAL/ArticleGateway.php @@ -1,7 +1,7 @@ con->getResults(); } + public function addArticle(Article $article){ + $query = 'INSERT INTO Article VALUES (:id,:title,to_date(:date,"Dy, DD Mon YYYY"),:description,:guid,:link,:mediaContent,:provenance);'; + $this->con->executeQuery($query, array( ':id' => array($article->getId(), PDO::PARAM_STR), + ':title' => array($article->getTitle(), PDO::PARAM_STR), + ':date' => array($article->getDate(),PDO::PARAM_STR), + ':description' => array($article->getDescription(),PDO::PARAM_STR), + ':guid' => array($article->getGuid(),PDO::PARAM_STR), + ':link' => array($article->getLink(),PDO::PARAM_STR), + ':mediaContent' => array($article->getMediaContent(),PDO::PARAM_STR), + ':provenance' => array($article->getProvenance(),PDO::PARAM_INT))); + } } \ No newline at end of file