parent
90932e4563
commit
fdc0578914
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
require_once 'Tache.php';
|
||||
require_once 'Utilisateur.php';
|
||||
|
||||
class TacheGateway{
|
||||
private $con;
|
||||
public function __construct(Connection $con){
|
||||
$this->con=$con;
|
||||
}
|
||||
|
||||
public Tache function Ajouter($nom, $description, Date $dateCreation, Utilisateur $createur){
|
||||
$query='INSERT INTO Tache VALUES($nom, $description, dateCreation, $createur)';
|
||||
|
||||
}
|
||||
|
||||
public function Editer(Tache $tache, string $nom, string $description){
|
||||
$query='UPDATE Tache SET :nom=$nom, :description=$description';
|
||||
$this->con->executeQuery($query, array('nom' => array($tache->nom, PDO::PARAM_STRING)), array('description' => array($tache->description, PDO::PARAM_STRING)));
|
||||
}
|
||||
|
||||
|
||||
public function Supprimer(Tache $tache){
|
||||
$query='DELETE FROM Tache WHERE utilisateur=:utilisateur AND nom=:nom AND id=:id';
|
||||
$this->con->executeQuery($query, array('utilisateur' => array($tache->createur, PDO::PARAM_INT),'nom' => array($tache->nom, PDO::PARAM_STRING), 'id' => array($tache->id, PDO::PARAM_INT)));
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in new issue