/** * Deletes round. * * @param Entity\LeagueImpl $league * @param Entity\RoundImpl $round * @throws RDException */ public function deleteRound($league, $round) { $q = 'UPDATE ' . DB_NAME . '.round SET league_id = ? WHERE round_id = ?;'; //create Prepared statement $stmt = $this->dbConnection->prepare($q); //bind parameter to query $null = null; $roundId = $round->getId(); $stmt->bindParam(1, $null); $stmt->bindParam(2, $roundId, \PDO::PARAM_INT); //execute query if ($stmt->execute()) { echo 'link deleted successfully'; } else { throw new RDException('Deletion of link unsuccessful'); } }
/** * Deletes round. * * @param Entity\RoundImpl $round to delete * @throws RDException */ public function delete($round) { if ($round->getId() == -1) { //if round isn't persistent, we are done return; } //Prepare mySQL query $q = 'DELETE FROM round WHERE round_id = ?;'; //create Prepared statement $stmt = $this->dbConnection->prepare($q); //bind parameter to query $roundId = $round->getId(); $stmt->bindParam(1, $roundId, \PDO::PARAM_INT); //execute query if ($stmt->execute()) { echo 'round deleted successfully'; } else { throw new RDException('Deletion of round unsuccessful'); } }