From 3b40d81a0da233401fff36363dd3c850a6188769 Mon Sep 17 00:00:00 2001 From: "victor.soulier" Date: Sun, 19 Nov 2023 12:51:42 +0100 Subject: [PATCH] ADD : mdl, metier, gw sexe --- project/src/model/gateways/SexeGateway.php | 19 ++++++++++++++++ project/src/model/mdl/MdlSexe.php | 17 +++++++++++++++ project/src/model/metier/Sexe.php | 25 ++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 project/src/model/gateways/SexeGateway.php create mode 100644 project/src/model/mdl/MdlSexe.php create mode 100644 project/src/model/metier/Sexe.php diff --git a/project/src/model/gateways/SexeGateway.php b/project/src/model/gateways/SexeGateway.php new file mode 100644 index 0000000..3a4e608 --- /dev/null +++ b/project/src/model/gateways/SexeGateway.php @@ -0,0 +1,19 @@ +con = $con; + } + + public function getFromId(int $id): array + { + $this->con->executeQuery("SELECT id, libelle FROM Sexe WHERE id=:id;", + [':id' => [$id, $this->con::PARAM_INT]]); + return $this->con->getOneResult(); + } +} \ No newline at end of file diff --git a/project/src/model/mdl/MdlSexe.php b/project/src/model/mdl/MdlSexe.php new file mode 100644 index 0000000..bc9cf40 --- /dev/null +++ b/project/src/model/mdl/MdlSexe.php @@ -0,0 +1,17 @@ +gw = new SexeGateway($this->con); + } + + public function getFromId(int $id): Sexe{ + $row = $this->gw->getFromId($id); + return new Sexe($row['id'], $row['libelle']); + } +} \ No newline at end of file diff --git a/project/src/model/metier/Sexe.php b/project/src/model/metier/Sexe.php new file mode 100644 index 0000000..86e6f89 --- /dev/null +++ b/project/src/model/metier/Sexe.php @@ -0,0 +1,25 @@ +id=$id; + $this->libelle=$libelle; + } + + public function getId():int + { + return $this->id; + } + + public function getLibelle(): string + { + return $this->libelle; + } +} \ No newline at end of file