public function getAllBetween(\DateTime $start, \DateTime $end, \Club\UserBundle\Entity\User $user = null, \Club\UserBundle\Entity\Location $location = null, \Club\BookingBundle\Entity\Field $field = null)
 {
     $qb = $this->_em->createQueryBuilder()->select('s')->from('ClubTeamBundle:Schedule', 's')->where('(s.first_date <= :start and s.end_date >= :end)')->orWhere('(s.first_date <= :start and s.end_date <= :end and s.end_date >= :start)')->orWhere('(s.first_date >= :start and s.end_date >= :end and s.first_date < :end)')->orWhere('(s.first_date >= :start and s.end_date <= :end and s.end_date >= :start)')->orderBy('s.first_date')->setParameter('start', $start->format('Y-m-d H:i:s'))->setParameter('end', $end->format('Y-m-d H:i:s'));
     if (isset($user)) {
         $qb->leftJoin('s.users', 'u')->andWhere('u.user = :user')->setParameter('user', $user->getId());
     }
     if (isset($location)) {
         $qb->leftJoin('s.location', 'l')->andWhere('l.id = :location')->setParameter('location', $location->getId());
     }
     if (isset($field)) {
         $qb->leftJoin('s.fields', 'f')->andWhere('f.id = :field')->setParameter('field', $field->getId());
     }
     return $qb->getQuery()->getResult();
 }
 public function getAllByLocationDate(\Club\UserBundle\Entity\Location $location, \DateTime $date)
 {
     return $this->createQueryBuilder('b')->leftJoin('b.field', 'f')->leftJoin('f.location', 'l')->where('l.id = :location')->andWhere('b.status >= :status')->andWhere('b.first_date BETWEEN :start AND :stop')->setParameter('location', $location->getId())->setParameter('status', \Club\BookingBundle\Entity\Booking::CONFIRMED)->setParameter('start', $date->format('Y-m-d 00:00:00'))->setParameter('stop', $date->format('Y-m-d 23:59:59'))->getQuery()->getResult();
 }
 public function getRoot(\Club\UserBundle\Entity\Location $location)
 {
     return $this->createQueryBuilder('c')->where('c.location = :location')->andWhere('c.category IS NULL')->setParameter('location', $location->getId())->getQuery()->getResult();
 }
示例#4
0
 public function getChilds(\Club\UserBundle\Entity\Location $location)
 {
     return $this->_em->createQueryBuilder()->select('l')->from('ClubUserBundle:Location', 'l')->where('l.location = :parent')->setParameter('parent', $location->getId())->getQuery()->getResult();
 }
 public function getNextPosition(\Club\UserBundle\Entity\Location $location)
 {
     $r = $this->_em->createQueryBuilder()->select('f')->from('ClubBookingBundle:Field', 'f')->where('f.location = :location')->orderBy('f.position', 'DESC')->setMaxResults(1)->setParameter('location', $location->getId())->getQuery()->getOneOrNullResult();
     $ret = $r ? $r->getPosition() + 1 : 1;
     return $ret;
 }
示例#6
0
 public function setCurrent(\Club\UserBundle\Entity\Location $location)
 {
     $this->session->set('location_id', $location->getId());
     $this->session->set('location_name', $location->getLocationName());
     return true;
 }
 public function getICSByLocation(\Club\UserBundle\Entity\Location $location, \DateTime $date)
 {
     $plans = $this->getQuery($date)->andWhere('f.location = :location')->setParameter('location', $location->getId())->getQuery()->getResult();
     return $this->getIcsFromPlans($plans);
 }