function punishAndDie(Team $team, Game $game) { $team->addPenatly($game->getGameId(), $game->getRound()); rollbackAndDie(); }
public function equals(Game $game) { return $this->getGameId() == $game->getGameId(); }
/** * test inserting a valid Game and regrabbing it from mySQL **/ public function testGetValidGameByGameId() { // count the number of rows and save it for later $numRows = $this->getConnection()->getRowCount("game"); // create a new Game and insert to into mySQL $game = new Game(null, $this->game->getGameId(), $this->VALID_GAME); $game->insert($this->getPDO()); // grab the data from mySQL and enforce the fields match our expectations $pdoGame = Game::getGameByGameId($this->getPDO(), $game->getGameId()); $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("game")); $this->assertEquals($pdoGame->getGameId(), $this->game->getGameId()); }
private function history() { $current_game = new Game($this->getGameId()); $current_game->build(); db_insert('game_history')->fields(array('gameid' => $current_game->getGameId(), 'home_teamid' => $current_game->getHomeTeamId(), 'visiting_teamid' => $current_game->getVisitingTeamId(), 'locationid' => $current_game->getLocationId(), 'seasonid' => $current_game->getSeasonId(), 'start_datetime' => $current_game->getStartDateTime(), 'playoff_game_yn' => $current_game->getPlayoffGameYN(), 'saved_userid' => $current_game->getSavedUserID(), 'saved_datetime' => $current_game->getSavedDateTime(), 'history_userid' => $this->getSavedUserID(), 'history_datetime' => $this->getSavedDateTime(), 'home_team_first_period_goals' => $current_game->getHomeTeamFirstPeriodGoals(), 'visiting_team_first_period_goals' => $current_game->getVisitingTeamFirstPeriodGoals(), 'home_team_second_period_goals' => $current_game->getHomeTeamSecondPeriodGoals(), 'visiting_team_second_period_goals' => $current_game->getVisitingTeamSecondPeriodGoals(), 'home_team_third_period_goals' => $current_game->getHomeTeamThirdPeriodGoals(), 'visiting_team_third_period_goals' => $current_game->getVisitingTeamThirdPeriodGoals(), 'home_team_over_time_goals' => $current_game->getHomeTeamOverTimeGoals(), 'visiting_team_over_time_goals' => $current_game->getVisitingTeamOverTimeGoals(), 'home_team_shots' => $current_game->getHomeTeamShots(), 'visiting_team_shots' => $current_game->getVisitingTeamShots(), 'comment' => $current_game->getComment()))->execute(); }