ADD : méthode getFromId(id)

correction_routeur^2
Victor SOULIER 1 year ago
parent 453fb4381a
commit 7033bb4c1f

@ -18,4 +18,12 @@ class DifficulteGateway
} }
return $listDifficulte; 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']);
}
} }

@ -2,6 +2,8 @@
namespace model; namespace model;
use PDO;
class JeuGateway class JeuGateway
{ {
private $con; private $con;
@ -18,4 +20,12 @@ class JeuGateway
} }
return $listJeu; 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']);
}
} }
Loading…
Cancel
Save