From cb22e20817b8f44f2827a2d5f1dbab2c6fe2190c Mon Sep 17 00:00:00 2001 From: "victor.soulier" Date: Fri, 17 Nov 2023 09:30:27 +0100 Subject: [PATCH] ADD : difficulte depuis db --- .../src/model/gateways/DifficulteGateway.php | 21 ++++++++++++ project/src/model/metier/Difficulte.php | 33 +++++++++++++++++++ project/src/model/metier/Difficulty.php | 10 ------ 3 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 project/src/model/gateways/DifficulteGateway.php create mode 100644 project/src/model/metier/Difficulte.php delete mode 100644 project/src/model/metier/Difficulty.php diff --git a/project/src/model/gateways/DifficulteGateway.php b/project/src/model/gateways/DifficulteGateway.php new file mode 100644 index 0000000..5917df4 --- /dev/null +++ b/project/src/model/gateways/DifficulteGateway.php @@ -0,0 +1,21 @@ +con = $con; + } + public function getAll() : array + { + $this->con->executeQuery("SELECT id, libelle FROM Difficulte;"); + $listDifficulte = []; + foreach($this->con->getResults() as $row){ + $listDifficulte[] = new Difficulte($row['id'], $row['libelle']); + } + return $listDifficulte; + } +} \ No newline at end of file diff --git a/project/src/model/metier/Difficulte.php b/project/src/model/metier/Difficulte.php new file mode 100644 index 0000000..838d89a --- /dev/null +++ b/project/src/model/metier/Difficulte.php @@ -0,0 +1,33 @@ +id=$id; + $this->libelle=$libelle; + } + + /** + * @return int + */ + public function getId(): int{ + return $this->id; + } + + /** + * @return string + */ + public function getLibelle(): string{ + return $this->libelle; + } +} \ No newline at end of file diff --git a/project/src/model/metier/Difficulty.php b/project/src/model/metier/Difficulty.php deleted file mode 100644 index 79801e9..0000000 --- a/project/src/model/metier/Difficulty.php +++ /dev/null @@ -1,10 +0,0 @@ -