generated from Templates_CodeFirst/templateHtmlCss
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.
45 lines
1.0 KiB
45 lines
1.0 KiB
<?php
|
|
|
|
|
|
class MdlTache{
|
|
|
|
private $con;
|
|
|
|
public function __construct(){
|
|
|
|
global $rep,$vues,$dsn, $login, $password;
|
|
$this->con = new Connection($dsn, $login, $password);
|
|
}
|
|
|
|
|
|
public function insert(string $name, string $content ,bool $completed, string $idListe): Tache{
|
|
$gate=new TacheGateway($this->con);
|
|
$t=new Tache(0, $name, $content, $completed);
|
|
$gate->insert($t, $idListe);
|
|
$id=$gate->getLastId();
|
|
$t->setId($id);
|
|
return $t;
|
|
}
|
|
|
|
public function delete(int $id){
|
|
$gate=new TacheGateway($this->con);
|
|
$gate->delete($id);
|
|
}
|
|
|
|
public function update(Tache $tache, string $name, string $content, bool $completed){
|
|
$gate=new TacheGateway($this->con);
|
|
$tache->setName($name);
|
|
$tache->setContent($content);
|
|
$tache->setCompleted($completed);
|
|
$gate->update($tache);
|
|
}
|
|
|
|
public function findById(int $id): Tache{
|
|
$gate=new TacheGateway($this->con);
|
|
return $gate->findById($id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|