コード例 #1
0
 public static function setEventForTournament($id_tournament)
 {
     $winners = array_keys(ArrayHelper::index(Result::getWinners($id_tournament), 'participant'));
     foreach ($winners as $position => $team) {
         self::updateAll(['event' => self::TEAM_IN_TOP_3], ['and', ['id_participant_team' => $team], ['id_tournament' => $id_tournament], ['not', ['forecasted_position' => $position + 1]]]);
         self::updateAll(['event' => self::TEAM_POSITION], ['and', ['id_participant_team' => $team], ['id_tournament' => $id_tournament], ['forecasted_position' => $position + 1]]);
         self::updateAll(['event' => NULL], ['and', ['id_tournament' => $id_tournament], ['not in', 'id_participant_team', $winners]]);
     }
 }