forked from tom.biard/ScienceQuest
parent
98f1135d76
commit
cb22e20817
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace model;
|
||||
|
||||
class DifficulteGateway
|
||||
{
|
||||
private $con;
|
||||
|
||||
function __construct(Connection $con) {
|
||||
$this->con = $con;
|
||||
}
|
||||
public function getAll() : array
|
||||
{
|
||||
$this->con->executeQuery("SELECT id, libelle FROM Difficulte;");
|
||||
$listDifficulte = [];
|
||||
foreach($this->con->getResults() as $row){
|
||||
$listDifficulte[] = new Difficulte($row['id'], $row['libelle']);
|
||||
}
|
||||
return $listDifficulte;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace model;
|
||||
|
||||
class Difficulte
|
||||
{
|
||||
private int $id;
|
||||
private string $libelle;
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $libelle
|
||||
*/
|
||||
public function __construct(int $id, string $libelle)
|
||||
{
|
||||
$this->id=$id;
|
||||
$this->libelle=$libelle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): int{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLibelle(): string{
|
||||
return $this->libelle;
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace model;
|
||||
|
||||
enum Difficulty
|
||||
{
|
||||
case Easy;
|
||||
case Medium;
|
||||
case Hard;
|
||||
}
|
Loading…
Reference in new issue