|
|
@ -12,7 +12,7 @@ class PartieGateway
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->con = $con;
|
|
|
|
$this->con = $con;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function creerPartie($listeEmailJoueur){
|
|
|
|
public function creerPartie(){
|
|
|
|
$query = "SELECT * FROM Enigme";
|
|
|
|
$query = "SELECT * FROM Enigme";
|
|
|
|
$this->con->executeQuery($query);
|
|
|
|
$this->con->executeQuery($query);
|
|
|
|
$results = $this->con->getResults();
|
|
|
|
$results = $this->con->getResults();
|
|
|
@ -20,7 +20,7 @@ class PartieGateway
|
|
|
|
FROM PARTIE p;";
|
|
|
|
FROM PARTIE p;";
|
|
|
|
$this->con->executeQuery($query);
|
|
|
|
$this->con->executeQuery($query);
|
|
|
|
$max=$this->con->getResults()[0];
|
|
|
|
$max=$this->con->getResults()[0];
|
|
|
|
$partie=PartieFactory::createPartie($max,$results,$listeEmailJoueur);
|
|
|
|
$partie=PartieFactory::createPartie($max,$results);
|
|
|
|
$query= "INSERT INTO Partie VALUES (:idPartie,:idEnigme)";
|
|
|
|
$query= "INSERT INTO Partie VALUES (:idPartie,:idEnigme)";
|
|
|
|
$this->con->executeQuery($query, array(':idPartie' => array($partie->getIdPartie(), PDO::PARAM_STR)));
|
|
|
|
$this->con->executeQuery($query, array(':idPartie' => array($partie->getIdPartie(), PDO::PARAM_STR)));
|
|
|
|
foreach($partie->getListeEnigme() as $Enigme){
|
|
|
|
foreach($partie->getListeEnigme() as $Enigme){
|
|
|
@ -35,6 +35,27 @@ class PartieGateway
|
|
|
|
$this->con->executeQuery($query, array(':idPartie' => array($idPartie, PDO::PARAM_STR)));
|
|
|
|
$this->con->executeQuery($query, array(':idPartie' => array($idPartie, PDO::PARAM_STR)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function findOldListePartie() : array{
|
|
|
|
|
|
|
|
$query="SELECT * FROM Partie";
|
|
|
|
|
|
|
|
$this->con->executeQuery($query);
|
|
|
|
|
|
|
|
$results = $this->con->getResults();
|
|
|
|
|
|
|
|
$query= "SELECT max(p.id)
|
|
|
|
|
|
|
|
FROM PARTIE p;";
|
|
|
|
|
|
|
|
$this->con->executeQuery($query);
|
|
|
|
|
|
|
|
$max=$this->con->getResults()[0];
|
|
|
|
|
|
|
|
$listePartie=array();
|
|
|
|
|
|
|
|
foreach($results as $row)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$query = "SELECT e.* FROM Enigme e,Contenir c,Partie p
|
|
|
|
|
|
|
|
WHERE p.id = c.partie
|
|
|
|
|
|
|
|
AND c.enigme = e.id";
|
|
|
|
|
|
|
|
$this->con->executeQuery($query);
|
|
|
|
|
|
|
|
$listeEnigme=$this->con->getResults();
|
|
|
|
|
|
|
|
$listePartie=PartieFactory::createPartie($max,$listeEnigme);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $listePartie;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function findOldListeEnigme(string $partie) : array{
|
|
|
|
public function findOldListeEnigme(string $partie) : array{
|
|
|
|
$query= "SELECT * FROM Enigme e,Contenir c
|
|
|
|
$query= "SELECT * FROM Enigme e,Contenir c
|
|
|
|
AND c.partie = :idPartie
|
|
|
|
AND c.partie = :idPartie
|
|
|
|