/** * @param Entity\ScoreReportImpl $modelReport * @return ScoreReportIterator * @throws RDException */ public function restore($modelReport) { $q = 'SELECT * from score_report WHERE 1=1 '; if ($modelReport != NULL) { if ($modelReport->getHomePoints() != NULL) { $q .= ' AND home_points = ' . $modelReport->getHomePoints(); } if ($modelReport->getAwayPoints() != NULL) { $q .= ' AND away_points = ' . $modelReport->getAwayPoints(); } //if ($modelReport->getDate() != NULL) { // $q .= ' AND score_report.date = ' . $modelReport->getDate(); //} if ($modelReport->getMatch() != NULL) { $q .= ' AND match_id = ' . $modelReport->getMatch()->getId(); } if ($modelReport->getId() != -1) { $q .= ' AND score_report_id = ' . $modelReport->getId(); } } $stmt = $this->dbConnection->prepare($q . ';'); if ($stmt->execute()) { //get results from Query $resultSet = $stmt->fetchAll(\PDO::FETCH_ASSOC); // return iterator return new ScoreReportIterator($resultSet, $this->objLayer); } else { throw new RDException('Error restoring report model'); } }
/** * Automatically called from the end of the creation of the second score report of a match * if the scores in the two ScoreReports are the same, the score in the Match is set to be as * reported; otherwise, a message ConflictingScoresReported message * * @param Entity\ScoreReportImpl $report1 * @param Entity\ScoreReportImpl $report2 * @param Entity\MatchImpl $match * @throws RDException if the scores conflict. The admin needs to resolve this. * @return void */ public function confirmMatchScore($report1, $report2, $match) { // TODO: figure out how to notify admin of a dispute if (!($report2->getHomePoints() == $report1->getAwayPoints() && $report1->getHomePoints() == $report2->getAwayPoints())) { throw new RDException($string = "There are discrepancies in the two score reports"); } }