public function insertAction() { if (isset($_POST['directorName'])) { $_POST['directorName'] = strip_tags($_POST['directorName']); $dto = new DirectorDTO(); $dao = new DirectorDAO(); $dto->hydrate($_POST); $dao->insert($dto); } header('Location: index.php?ctrl=director&act=index'); }
public function find($id) { $id = (int) $id; $dir = false; $stmt = $this->pdo->prepare("SELECT realisateur_id, nom_realisateur FROM realisateur WHERE realisateur_id=?;"); $stmt->bindValue(1, $id); $stmt->execute(); $res = $stmt->fetch(PDO::FETCH_ASSOC); if ($res) { $dir = new DirectorDTO(); $dir->hydrateSQL($res); } return $dir; }