|
|
@ -14,18 +14,13 @@ class JeuGateway
|
|
|
|
public function getAll() : array
|
|
|
|
public function getAll() : array
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu;");
|
|
|
|
$this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu;");
|
|
|
|
$listJeu = [];
|
|
|
|
return $this->con->getResults();
|
|
|
|
foreach($this->con->getResults() as $row){
|
|
|
|
|
|
|
|
$listJeu[] = new Jeu($row['id'], $row['nom'], $row['nbrparties']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $listJeu;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getFromId(int $id): Jeu
|
|
|
|
public function getFromId(int $id): array
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu WHERE id=:id;",
|
|
|
|
$this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu WHERE id=:id;",
|
|
|
|
[':id' => [$id, $this->con::PARAM_INT]]);
|
|
|
|
[':id' => [$id, $this->con::PARAM_INT]]);
|
|
|
|
$row = $this->con->getOneResult();
|
|
|
|
return $this->con->getOneResult();
|
|
|
|
return new Jeu($row['id'], $row['nom'], $row['nbrparties']);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|