From a2f4b1243a78415ec4a20ae4a20413e4a64dbaa7 Mon Sep 17 00:00:00 2001 From: "victor.soulier" Date: Sat, 18 Nov 2023 14:58:15 +0100 Subject: [PATCH] =?UTF-8?q?FIX=20:=20modifications=20pour=20l'ajout=20de?= =?UTF-8?q?=20la=20couche=20mod=C3=A8le?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/src/model/gateways/JeuGateway.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/project/src/model/gateways/JeuGateway.php b/project/src/model/gateways/JeuGateway.php index 3be2b3c..0f3f74a 100644 --- a/project/src/model/gateways/JeuGateway.php +++ b/project/src/model/gateways/JeuGateway.php @@ -14,18 +14,13 @@ class JeuGateway public function getAll() : array { $this->con->executeQuery("SELECT id, nom, nbrparties FROM Jeu;"); - $listJeu = []; - foreach($this->con->getResults() as $row){ - $listJeu[] = new Jeu($row['id'], $row['nom'], $row['nbrparties']); - } - return $listJeu; + return $this->con->getResults(); } - public function getFromId(int $id): Jeu + public function getFromId(int $id): array { $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']); + return $this->con->getOneResult(); } } \ No newline at end of file