@ -35,7 +35,7 @@ class EnigmeGateway
*/
public function insert(Enigme $enigme)
{
$query = "INSERT INTO Enigme VALUES (NULL,:nom,:enonce,:aide,:rappel,:exemple,:solution,:test,:tempsDeResolution,:points)";
$query = "INSERT INTO Enigme VALUES (NULL,:nom,:enonce,:aide,:rappel,:exemple,:solution,:test, :ordre, :tempsDeResolution,:points, :prompt )";
$this->con->executeQuery($query, array(
':nom' => array($enigme->getNom(), SQLITE3_TEXT),
':enonce' => array($enigme->getEnonce(), SQLITE3_TEXT),
@ -44,8 +44,10 @@ class EnigmeGateway
':exemple' => array($enigme->getExemple(), SQLITE3_TEXT),
':solution' => array($enigme->getSolution(), SQLITE3_TEXT),
':test' => array($enigme->getTest(), SQLITE3_TEXT),
':ordre' => array($enigme->getOrdre(), SQLITE3_INTEGER),
':tempsDeResolution' => array($enigme->getTempsDeResolution(), SQLITE3_INTEGER),
':points' => array($enigme->getPoints(), SQLITE3_INTEGER)
':points' => array($enigme->getPoints(), SQLITE3_INTEGER),
':prompt' => array($enigme->getPrompt(), SQLITE3_TEXT)
));
}
@ -129,6 +131,16 @@ class EnigmeGateway
$tabEnigme=EnigmeFactory::create($results);
return $tabEnigme;
}
public function findByOrdre(int $ordre) : array
{
$query = "SELECT * FROM Enigme WHERE ordre = :ordre";
$this->con->executequery($query,array(
':ordre' => array($ordre,SQLITE3_INTEGER)
));
$results = $this->con->getResults();
$tabEnigme=EnigmeFactory::create($results);
return $tabEnigme;
}
public function showAll(): void
{
$query = "SELECT * FROM Enigme";