/** * 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'); } }
/** * Create a new Round object. * @param number the number of this round of matches * @param Entity\LeagueImpl the league that the round belongs to * @return a new Round object instance * @throws RDException in case the number is not positive */ public function createRound($number = null, $league = null) { $aRound = new Entity\RoundImpl(); if ($number != null && $league != null) { $aRound->setNumber($number); $aRound->setLeague($league); } return $aRound; }
/** * 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'); } }