From 5cdc0e6ddcd5d632cf226051dc906191f26377ad Mon Sep 17 00:00:00 2001 From: "gwenael.planchon" Date: Mon, 20 Nov 2023 14:51:34 +0100 Subject: [PATCH] ajouter getsexes --- project/src/model/gateways/SexeGateway.php | 6 ++++++ project/src/model/mdl/MdlSexe.php | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/project/src/model/gateways/SexeGateway.php b/project/src/model/gateways/SexeGateway.php index 3a4e608..f2672cf 100644 --- a/project/src/model/gateways/SexeGateway.php +++ b/project/src/model/gateways/SexeGateway.php @@ -16,4 +16,10 @@ class SexeGateway [':id' => [$id, $this->con::PARAM_INT]]); return $this->con->getOneResult(); } + + public function getSexes(): array + { + $this->con->executeQuery("SELECT id, libelle FROM Sexe;"); + return $this->con->getResults(); + } } \ No newline at end of file diff --git a/project/src/model/mdl/MdlSexe.php b/project/src/model/mdl/MdlSexe.php index bc9cf40..0bb7362 100644 --- a/project/src/model/mdl/MdlSexe.php +++ b/project/src/model/mdl/MdlSexe.php @@ -14,4 +14,12 @@ class MdlSexe extends MdlBase{ $row = $this->gw->getFromId($id); return new Sexe($row['id'], $row['libelle']); } + public function getSexes(): array { + $ret=array(); + $row = $this->gw->getSexes(); + for($i=0; $i< count($row); $i++){ + array_push($ret, new Sexe($row[$i]['id'], $row[$i]['libelle'])); + } + return $ret; + } } \ No newline at end of file