/** * Supprime un spectacle * @param Spectacle $spectacle * @throws \Exception */ public static function rmSpectacle(Spectacle $spectacle) { $conn = Main::bdd(); try { $conn->beginTransaction(); MSaison::rmSaisonSpectacle($spectacle); foreach ($spectacle->getLesSeances()->getCollection() as $seance) { MPlanning::rmPlanningbySeance($seance); } MSeance::rmSeancesSpec($spectacle); $reqPrepare = $conn->prepare("DELETE FROM spectacle WHERE idSpectacle = ?"); $reqPrepare->execute(array($spectacle->getId())); $conn->commit(); } catch (\PDOException $e) { $conn->rollBack(); throw new \Exception("Le spectacle " . $spectacle->getId() . " n'a pas pu être supprimé. Détails : <p>" . $e->getMessage() . "</p>"); } }