You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.5 KiB
52 lines
1.5 KiB
<?php
|
|
|
|
class DetailPartieGateway
|
|
{
|
|
private Connection $con;
|
|
|
|
/**
|
|
* @param Connection $con
|
|
*/
|
|
public function __construct(Connection $con)
|
|
{
|
|
$this->con = $con;
|
|
}
|
|
|
|
/**
|
|
* @param Connection $con
|
|
*/
|
|
public function setCon(Connection $con): void
|
|
{
|
|
$this->con = $con;
|
|
}
|
|
|
|
public function insert(DetailPartie $detailPartie)
|
|
{
|
|
$query="INSERT INTO DetailPartie VALUES (:idDetailPartie,:joueur,:partie,:enigme,:pointsObtenus,:classement)";
|
|
$this->con->executeQuery($query,array(
|
|
'idDetailPartie' => array($detailPartie->getIdDetailPartie(),PDO::PARAM_STR),
|
|
'joueur' => array($detailPartie->getJoueur(),PDO::PARAM_STR),
|
|
'partie' => array($detailPartie->getPartie(),PDO::PARAM_STR),
|
|
'enigme' => array($detailPartie->getEnigme(),PDO::PARAM_STR),
|
|
'pointsObtenus' => array($detailPartie->getPointsObtenus(),PDO::PARAM_INT),
|
|
'classement' => array($detailPartie->getClassement(),PDO::PARAM_INT)
|
|
));
|
|
}
|
|
public function delete(string $partie){
|
|
$query="DELETE * FROM DetailPartie WHERE partie=:partie";
|
|
$this->con->executeQuery($query,array(
|
|
'partie' => array($partie,PDO::PARAM_STR)
|
|
));
|
|
}
|
|
public function showAll(){
|
|
$query="SELECT * FROM DetailPartie";
|
|
$this->con->executeQuery($query);
|
|
$results=$this->con->getResults();
|
|
foreach($results as $row)
|
|
{
|
|
$row['idDetailPartie'];
|
|
}
|
|
}
|
|
|
|
|
|
} |