From e971de12955c9ed275d1ef680ae979e2007ba1fd Mon Sep 17 00:00:00 2001 From: "gwenael.planchon" Date: Tue, 21 Nov 2023 17:06:32 +0100 Subject: [PATCH] ajout get/edit MdlScientifque --- project/src/model/mdl/MdlScientifique.php | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/project/src/model/mdl/MdlScientifique.php b/project/src/model/mdl/MdlScientifique.php index bcac636..22a67ce 100755 --- a/project/src/model/mdl/MdlScientifique.php +++ b/project/src/model/mdl/MdlScientifique.php @@ -43,5 +43,39 @@ class MdlScientifique extends MdlBase{ } public function addScientifique(Scientifique $s){ return $this->gw->addScientifique($s); + } + public function editScientifique(Scientifique $s){ + return $this->gw->editScientifique($s); + } + + public function getScientifique(int $id){ + $t=$this->gw->getScientifique($id); + if(gettype($t)!="array"){ + throw new Exception("Scientifique non trouvé"); + } + + $sexe=new MdlSexe(); + $sexe=$sexe->getFromId($t["idsexe"]); + + $diff=new MdlDifficulte(); + $diff=$diff->getFromId($t["iddifficulte"]); + + $theme=new MdlThematique(); + $theme=$theme->getFromId($t["idthematique"]); + + return new Scientifique( + $id, + $t["nom"], + $t["prenom"], + $t["photo"], + DateTime::createFromFormat("Y-m-d", $t["datenaissance"]), + $t["descriptif"], + $t["ratiotrouvee"], + $theme, + $diff, + $sexe + ); + + } } \ No newline at end of file