Example #1
0
 public function removeUser(\Club\TournamentBundle\Entity\Tournament $tournament, \Club\UserBundle\Entity\User $user)
 {
     $attend = $this->em->getRepository('ClubTournamentBundle:Attend')->findOneBy(array('user' => $user->getId(), 'tournament' => $tournament->getId()));
     $this->em->remove($attend);
     $this->em->flush();
     return $this;
 }
 public function isAttending(\Club\TournamentBundle\Entity\Tournament $tournament, \Club\UserBundle\Entity\User $user)
 {
     return $this->_em->createQueryBuilder()->select('t')->from('ClubTournamentBundle:Tournament', 't')->leftJoin('t.attends', 'a')->where('t.id = :tournament')->andWhere('a.user = :user')->setParameter('tournament', $tournament->getId())->setParameter('user', $user->getId())->getQuery()->getOneOrNullResult();
 }
 public function getSeeds(\Club\TournamentBundle\Entity\Tournament $tournament)
 {
     return $this->_em->createQueryBuilder()->select('a')->from('ClubTournamentBundle:Attend', 'a')->where('a.tournament = :tournament')->orderBy('a.seed')->setParameter('tournament', $tournament->getId())->getQuery()->getResult();
 }