gw = new ScientifiqueGateway($this->con); $this->mdlSexe = new MdlSexe(); $this->mdlDifficulte = new MdlDifficulte(); $this->mdlThematique = new MdlThematique(); } /** * @throws Exception */ public function getRandom(): Scientifique{ $row = $this->gw->getRandom(); if(!$row) throw new RuntimeException("Erreur aucun scientifique trouvé"); $sexe = $this->mdlSexe->getFromId($row['idsexe']); $difficulte = $this->mdlDifficulte->getFromId($row['iddifficulte']); $thematique = $this->mdlThematique->getFromId($row['idthematique']); return new Scientifique($row['id'], $row['nom'], $row['prenom'], $row['photo'], new DateTime($row['datenaissance']), $row['descriptif'], $row['ratiotrouvee'], $thematique, $difficulte, $sexe); } }