public function getByMatch(\Club\MatchBundle\Entity\Match $match)
 {
     return $this->createQueryBuilder('r')->join('r.matches', 'm', 'with', 'm.match = :match_id')->setParameter('match_id', $match->getId())->getQuery()->getOneOrNullResult();
 }
示例#2
0
 private function validateGender(\Club\MatchBundle\Entity\Match $match)
 {
     if (!$this->ranking->getGender()) {
         return;
     }
     foreach ($match->getMatchTeams() as $team) {
         foreach ($team->getTeam()->getUsers() as $user) {
             if ($user->getProfile()->getGender() != $this->ranking->getGender()) {
                 throw new \Exception($this->translator->trans('Only %gender% is allowed to play in this league.', array('%gender%' => $this->ranking->getGender())));
             }
         }
     }
 }