Exemplo n.º 1
0
 /**
  * Create a new Match object, given the set of initial attribute values.
  * @param homePoints the points won by the home team (must be non-negative)
  * @param awayPoints the points won by the away team (must be non-negative)
  * @param date the date of the match
  * @param isCompleted has the match been completed?
  * @param homeTeam the team which is the home team in this match
  * @param awayTeam the team which is the away team in this match
  * @param Entity\RoundImpl the round in which this match is played
  * @return Entity\MatchImpl t new Match object instance with the given attribute values
  * @throws RDException in case any of the po$arguments is negative or either of the teams is null or if the given teams are not in the same league
  */
 public function createMatch($homePoints = null, $awayPoints = null, $date = null, $isCompleted = null, $homeTeam = null, $awayTeam = null, $sportsVenue = null, $round = null)
 {
     $aMatch = new Entity\MatchImpl();
     if ($homePoints != null && $awayPoints != null && $date != null && $isCompleted != null && $homeTeam != null && $awayTeam != null) {
         $aMatch->setHomePoints($homePoints);
         $aMatch->setAwayPoints($awayPoints);
         $aMatch->setDate($date);
         $aMatch->setIsCompleted($isCompleted);
         $aMatch->setHomeTeam($homeTeam);
         //echo 'match' .  var_dump($aMatch);
         $aMatch->setAwayTeam($awayTeam);
         $aMatch->setSportsVenue($sportsVenue);
         $aMatch->setRound($round);
     }
     return $aMatch;
 }
Exemplo n.º 2
0
 /**
  * resolves match score when 2 score reports differ.
  *
  * @param int $fixedHomeScore
  * @param int $fixedAwayScore
  * @param Entity\MatchImpl $match
  * @throws RDException if match is null or scores are negative
  * @return void
  */
 public function resolveMatchScore($fixedHomeScore, $fixedAwayScore, $match)
 {
     $match->setHomePoints($fixedHomeScore);
     $match->setAwayPoints($fixedAwayScore);
     $this->objectLayer->storeMatch($match);
     /*$homeTeam = $match->getHomeTeam();
             $awayTeam = $match->getAwayTeam();
             //create empty score report
             $modelScoreReport = $this->objectLayer->createScoreReport();
             $modelScoreReport->setMatch($match);
     
             //get both score reports for this match
             $scoreReportIter = $this->objectLayer->findScoreReport($modelScoreReport);
     
             //go through both reports and update the scores
             while($scoreReportIter->current()){
                 $scoreReport = $scoreReportIter->current();
                 //TODO figure out how to set the currect values of the score reports
                 $scoreReportIter->next();
             }*/
 }