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