コード例 #1
0
 public function getPlayerEvents(Player $player)
 {
     $events = $this->findByPlayer($player->getId());
     return $events;
 }
コード例 #2
0
 /**
  * Checks if a candidate is blocked by some other event
  * Checks for schedule collisions
  * @param \Sportnetzwerk\SpnBundle\Entity\Player $player
  * @param type $start current event start
  * @param type $end current event end
  */
 public function blockedByEvent(Player $player, $start, $end)
 {
     $blockedCandidate = array();
     $qb = $this->createQueryBuilder('pl')->where('pl.id = ?1')->innerJoin('SportnetzwerkSpnBundle:PlayerEvents', 'ple', 'with', 'ple.player = pl.id')->innerJoin('SportnetzwerkSpnBundle:Events', 'e', 'with', 'e.id = ple.event AND (e.start < ?2 AND e.end > ?3) AND ple.accepted = 1')->setParameters(array(1 => $player->getId(), 2 => $end, 3 => $start));
     $blockedCandidate = $qb->getQuery()->getResult();
     return empty($blockedCandidate) ? false : true;
 }