From 05952b9434067683090efacaaf70ca66df9685bf Mon Sep 17 00:00:00 2001 From: Kevin MONDEJAR Date: Wed, 23 Oct 2024 15:14:57 +0200 Subject: [PATCH] Supprimer 'models/commentaryGateway.php' --- models/commentaryGateway.php | 68 ------------------------------------ 1 file changed, 68 deletions(-) delete mode 100644 models/commentaryGateway.php diff --git a/models/commentaryGateway.php b/models/commentaryGateway.php deleted file mode 100644 index 4643478..0000000 --- a/models/commentaryGateway.php +++ /dev/null @@ -1,68 +0,0 @@ -co = $co; - } - - public function create(commentaryEntity $c) :bool { - - $query="INSERT INTO Commentary VALUES(:id_comment, :comment , :date)"; - - return $this -> co -> executeQuery($query, array( - "id_comment" => array($c->getIdComment(), PDO::PARAM_INT), - "comment" => array($c->getComment(), PDO::PARAM_STR), - "date" => array($c->getDate(), PDO::PARAM_STR))); - } - - public function findById(int $id) : ?commentaryEntity { - - $query="SELECT * FROM Commentary WHERE id_comment = :id_comment"; - - $this -> co -> executeQuery($query, array("id_comment" => $id)); - $res = $this -> co -> getResults(); - if($res) - return new commentaryEntity($res["id_comment"], $res["comment"], $res["date"]); - return null; - } - - - public function findAll() : array { - $query="SELECT * FROM Commentary"; - $this -> co -> executeQuery($query); - $res = $this -> co -> getResults(); - - $comments = []; - foreach ($res as $comment) { - - $comments[] = new commentaryEntity( - $comment["id_comment"], - $comment["comment"], - $comment["date"] - ); - } - - return $comments; - } - - public function delete(int $id) : bool { - $query="DELETE FROM Commentary WHERE id_comment = :id_comment"; - return $this -> co -> executeQuery($query, array("id_comment" => $id)); - - } - - public function update(commentaryEntity $c) : bool { - - $query="UPDATE Commentary SET comment = :comment WHERE id_comment = :id_comment"; - - return $this -> co -> executeQuery($query, array( - "comment" => array($c->getComment(),PDO::PARAM_STR), - "id_comment" => array($c->getIdComment(),PDO::PARAM_INT)) - ); - - } -} \ No newline at end of file