diff --git a/project/src/model/gateways/DifficulteGateway.php b/project/src/model/gateways/DifficulteGateway.php index 5917df4..0725192 100644 --- a/project/src/model/gateways/DifficulteGateway.php +++ b/project/src/model/gateways/DifficulteGateway.php @@ -18,4 +18,12 @@ class DifficulteGateway } return $listDifficulte; } + + public function getFromId(int $id): Difficulte + { + $this->con->executeQuery("SELECT id, libelle FROM Difficulte WHERE id=:id;", + [':id' => [$id, $this->con::PARAM_INT]]); + $row = $this->con->getOneResult(); + return new Difficulte($row['id'], $row['libelle']); + } } \ No newline at end of file diff --git a/project/src/model/gateways/JeuGateway.php b/project/src/model/gateways/JeuGateway.php index d1c6c92..3be2b3c 100644 --- a/project/src/model/gateways/JeuGateway.php +++ b/project/src/model/gateways/JeuGateway.php @@ -2,6 +2,8 @@ namespace model; +use PDO; + class JeuGateway { private $con; @@ -18,4 +20,12 @@ class JeuGateway } return $listJeu; } + + public function getFromId(int $id): Jeu + { + $this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu WHERE id=:id;", + [':id' => [$id, $this->con::PARAM_INT]]); + $row = $this->con->getOneResult(); + return new Jeu($row['id'], $row['nom'], $row['nbrparties']); + } } \ No newline at end of file