private function getEnrollments(User $user) { $today = new DateTime(); $tournaments = $this->get('logic')->listAvailableTournaments(); $tournamentList = array(); foreach ($tournaments as $tournament) { $stat = $this->get('tmnt')->getTournamentStatus($tournament->getId(), $today); if ($stat != TournamentSupport::$TMNT_HIDE) { $tournamentList[$tournament->getId()] = array('tournament' => $tournament, 'enrolled' => 0); } } if ($user->getClub()) { $enrolled = $this->get('logic')->listAnyEnrolledByClub($user->getClub()->getId()); foreach ($enrolled as $enroll) { $tid = $enroll['tid']; if (isset($tournamentList[$tid])) { $tournamentList[$tid]['enrolled'] = $enroll['enrolled']; } } } return $tournamentList; }