|
|
@ -27,6 +27,12 @@ class EnigmeGateway
|
|
|
|
$this->con = $con;
|
|
|
|
$this->con = $con;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* It inserts a new row in the Enigme table, with the values of the Enigme object passed as
|
|
|
|
|
|
|
|
* parameter
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param Enigme enigme
|
|
|
|
|
|
|
|
*/
|
|
|
|
public function insert(Enigme $enigme)
|
|
|
|
public function insert(Enigme $enigme)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$query = "INSERT INTO Enigme VALUES (:id,:admin,:enonce,:aide,:rappel,:solution,:test,:tempsDeResolution,:points)";
|
|
|
|
$query = "INSERT INTO Enigme VALUES (:id,:admin,:enonce,:aide,:rappel,:solution,:test,:tempsDeResolution,:points)";
|
|
|
@ -43,6 +49,12 @@ class EnigmeGateway
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* It deletes a row from the table Enigme where the idEnigme is equal to the idEnigme passed as a
|
|
|
|
|
|
|
|
* parameter
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param string idEnigme the id of the enigma
|
|
|
|
|
|
|
|
*/
|
|
|
|
public function delete(string $idEnigme)
|
|
|
|
public function delete(string $idEnigme)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$query= "DELETE FROM Enigme WHERE idEnigme=:idEnigme";
|
|
|
|
$query= "DELETE FROM Enigme WHERE idEnigme=:idEnigme";
|
|
|
@ -51,6 +63,12 @@ class EnigmeGateway
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* It returns an array of Enigme objects
|
|
|
|
|
|
|
|
* For multiplayer Enigma
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return array An array of Enigme objects.
|
|
|
|
|
|
|
|
*/
|
|
|
|
public function findMultiEnigma() : array
|
|
|
|
public function findMultiEnigma() : array
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$query = "SELECT * FROM Enigme
|
|
|
|
$query = "SELECT * FROM Enigme
|
|
|
@ -60,6 +78,12 @@ class EnigmeGateway
|
|
|
|
return $tabEnigme;
|
|
|
|
return $tabEnigme;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* It returns an array of Enigma objects
|
|
|
|
|
|
|
|
* For Solo enigma
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return An array of objects.
|
|
|
|
|
|
|
|
*/
|
|
|
|
public function findSoloEnigma(){
|
|
|
|
public function findSoloEnigma(){
|
|
|
|
$query = "SELECT * FROM Enigme
|
|
|
|
$query = "SELECT * FROM Enigme
|
|
|
|
WHERE points IS NULL OR points = 0";
|
|
|
|
WHERE points IS NULL OR points = 0";
|
|
|
@ -77,7 +101,7 @@ class EnigmeGateway
|
|
|
|
$tabEnigme=EnigmeFactory::create($this->con->getResults());
|
|
|
|
$tabEnigme=EnigmeFactory::create($this->con->getResults());
|
|
|
|
return $tabEnigme;
|
|
|
|
return $tabEnigme;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
|
|
|
|
public function findById(string $idEnigme) : array
|
|
|
|
public function findById(string $idEnigme) : array
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$query="SELECT * FROM Enigme WHERE idEnigme =:idEnigme";
|
|
|
|
$query="SELECT * FROM Enigme WHERE idEnigme =:idEnigme";
|
|
|
|