|
|
|
@ -26,10 +26,13 @@ class ListeGateway
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function delete(int $id): void{
|
|
|
|
|
$results=findById($id);
|
|
|
|
|
$results=$this->findById($id);
|
|
|
|
|
$tacheGateway=new TacheGateway($this->con);
|
|
|
|
|
foreach($results[0]->getTaches() as $taches){
|
|
|
|
|
$tacheGateway->delete($taches);
|
|
|
|
|
foreach ($results as $row ) {
|
|
|
|
|
$taches=$tacheGateway->getTacheFromIdList($row['id']);
|
|
|
|
|
foreach($taches as $tata){
|
|
|
|
|
$tacheGateway->delete($tata);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$query = "DELETE FROM Liste where id=:id";
|
|
|
|
|
$this->con->executeQuery($query, array(':id' => array($id, PDO::PARAM_INT)));
|
|
|
|
@ -60,15 +63,14 @@ class ListeGateway
|
|
|
|
|
return $results;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function findById(string $id): array{
|
|
|
|
|
public function findById(int $id): Array{
|
|
|
|
|
$results=[];
|
|
|
|
|
$taches = array();
|
|
|
|
|
if (!empty($id)){
|
|
|
|
|
$query = "SELECT * FROM Liste WHERE id=:id";
|
|
|
|
|
$this->con->executeQuery($query, array(':id' => array($id, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
|
|
$results=$this->con->getResults();
|
|
|
|
|
return $results;
|
|
|
|
|
}
|
|
|
|
|
$results = $this->con->getResults();
|
|
|
|
|
}
|
|
|
|
|
return $results;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|