private static function createFromDb($resource) { if (!is_null($resource)) { $match = new Match(); $match->setMatchId($resource["match_id"]); $match->setMatchDateTime($resource["match_date_time"]); $match->setVenueId($resource["venue_id"]); $match->setPlayerCount($resource["player_count"]); $match->setWinningTeamId($resource["winning_team_id"]); $match->setTied($resource["tied"]); $match->setCreatedDate($resource["created_date"]); $match->setStatus($resource["status"]); return $match; } return null; }
private function getOrCreateMatchForToday() { $date_from = Utilities::today_start(); $date_to = Utilities::today_end(); $today_match = Match::getMatchByDateRange($date_from, $date_to); if (is_null($today_match)) { $match_date_time = date("Y-m-d " . $this->venue->getVenueDefaultHour() . ":00"); $today_match = new Match(); $today_match->setVenueId($this->venue->getVenueId()); $today_match->setPlayerCount(0); $today_match->setMatchDateTime($match_date_time); $today_match->setStatus(MatchLogic::STATUS_LFM); $today_match->persist(); } return $today_match; }