Ejemplo n.º 1
0
 public static function addSeance(Seance $seance)
 {
     $conn = Main::bdd();
     try {
         $conn->beginTransaction();
         $reqPrepare = $conn->prepare("INSERT INTO seance (idSpectacle, date_heure, idLieu) VALUES (?,?,?)");
         $reqPrepare->execute(array($seance->getSpectacle()->getId(), $seance->getDate()->format('Y-m-d H:i:s'), $seance->getLieu()->getId()));
         $conn->commit();
     } catch (\PDOException $e) {
         $conn->rollBack();
         throw new \Exception("L'ajout de la séance " . $seance->getId() . " a échouée. Détails : <p>" . $e->getMessage() . "</p>");
     }
 }