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.
Scripted/WEB/Controller/PartieGateway.php

33 lines
960 B

<?php
require_once "../Model/Partie.php";
require_once "../Config/Connection.php";
class PartieGateway
{
private Connection $con;
/**
* @param Connection $con
*/
public function __construct(Connection $con)
{
$this->con = $con;
}
public function insert(Partie $partie){
$query= "INSERT INTO Game VALUES (:idPartie)";
$this->con->executeQuery($query, array(':idPartie' => array($partie->getIdPartie(), PDO::PARAM_STR)));
}
public function delete(string $idPartie){
$query= "DELETE FROM Game WHERE idGame = :idPartie";
$this->con->executeQuery($query, array(':idPartie' => array($idPartie, PDO::PARAM_STR)));
}
public function showAll() : void{
$query= "SELECT * FROM Partie";
$this->con->executeQuery($query);
$results=$this->con->getResults();
foreach ($results as $row) {
echo $row['idPartie'] . '</br>';
}
}
}