From c7255091ec1fde3f020c00594e839072952eea52 Mon Sep 17 00:00:00 2001 From: "gwenael.planchon" Date: Tue, 21 Nov 2023 17:06:56 +0100 Subject: [PATCH] ajout editScientifique --- .../model/gateways/ScientifiqueGateway.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/project/src/model/gateways/ScientifiqueGateway.php b/project/src/model/gateways/ScientifiqueGateway.php index b48c8d9..0893f84 100755 --- a/project/src/model/gateways/ScientifiqueGateway.php +++ b/project/src/model/gateways/ScientifiqueGateway.php @@ -41,4 +41,29 @@ class ScientifiqueGateway ":idSexe"=>[$sci->getSexe()->getId(),$this->con::PARAM_STR] ]); } + public function editScientifique(Scientifique $sci): bool{ + return $this->con->executeQuery( + "UPDATE Scientifique SET nom = :nom, prenom = :prenom, photo = :photo, dateNaissance = :dateNaissance, descriptif = :descriptif, ratioTrouvee = :ratioTrouvee, idThematique = :idThematique, idDifficulte = :idDifficulte, idSexe = :idSexe WHERE id=:id;" + ,[ + ":nom"=>[$sci->getNom(),$this->con::PARAM_STR], + ":prenom"=>[$sci->getPrenom(),$this->con::PARAM_STR], + ":photo"=>[$sci->getPhoto(),$this->con::PARAM_STR], + ":dateNaissance"=>[date("Y-m-d H:i:s", $sci->getDateNaiss()->getTimestamp()),$this->con::PARAM_STR], + ":descriptif"=>[$sci->getDescriptif(),$this->con::PARAM_STR], + ":ratioTrouvee"=>[$sci->getRatioTrouvee(),$this->con::PARAM_STR], + ":idThematique"=>[$sci->getThematique()->getId(),$this->con::PARAM_STR], + ":idDifficulte"=>[$sci->getDifficulte()->getId(),$this->con::PARAM_STR], + ":idSexe"=>[$sci->getSexe()->getId(),$this->con::PARAM_STR], + ":id"=>[$sci->getId(),$this->con::PARAM_INT] + ]); + } + + public function getScientifique(int $id): b { + $this->con->executeQuery( + "SELECT id, nom, prenom, photo, dateNaissance, descriptif, ratioTrouvee, idThematique, idDifficulte, idSexe FROM Scientifique WHERE id=:id;" + ,[ + ":id"=>[$id,$this->con::PARAM_INT] + ]); + return $this->con->getOneResult(); + } } \ No newline at end of file