/** * Enregistre la commande finalisée du client * * @param Commande $uneCommande * @throws ErrorSQLException */ public static function ajouterCommande(Commande $uneCommande) { try { $conn = MConnexion::getBdd(); $conn->beginTransaction(); $reqPrepare = $conn->prepare('INSERT INTO commande (numClt,date,pointsUtilise) VALUES (?,?,?)'); $reqPrepare->execute([$uneCommande->getUnClient()->getId(), $uneCommande->getUneDate(), $uneCommande->getPointsUtilise()]); $conn->commit(); $conn = null; } catch (PDOException $ex) { $conn->rollBack(); throw new ErrorSQLException('Impossible de continuer la validation de la commande. Détails : ' . $ex->getMessage()); } }