3 namespace Rapsys\AirBundle\Repository
;
8 class SessionRepository
extends \Doctrine\ORM\EntityRepository
{
10 * Find session by location, slot and date
12 * @param $location The location
13 * @param $slot The slot
14 * @param $date The datetime
16 public function findOneByLocationSlotDate($location, $slot, $date) {
18 $ret = $this->getEntityManager()
19 ->createQuery('SELECT s FROM RapsysAirBundle:Session s WHERE (s.location = :location AND s.slot = :slot AND s.date = :date)')
20 ->setParameter('location', $location)
21 ->setParameter('slot', $slot)
22 ->setParameter('date', $date)
30 * Find sessions by date period
32 * @param $period The date period
34 public function findAllByDatePeriod($period) {
36 $ret = $this->getEntityManager()
37 ->createQuery('SELECT s FROM RapsysAirBundle:Session s WHERE s.date BETWEEN :begin AND :end')
38 ->setParameter('begin', $period->getStartDate())
39 ->setParameter('end', $period->getEndDate())
47 * Find sessions by location and date period
49 * @param $location The location
50 * @param $period The date period
52 public function findAllByLocationDatePeriod($location, $period) {
54 $ret = $this->getEntityManager()
55 ->createQuery('SELECT s FROM RapsysAirBundle:Session s WHERE (s.location = :location AND s.date BETWEEN :begin AND :end)')
56 ->setParameter('location', $location)
57 ->setParameter('begin', $period->getStartDate())
58 ->setParameter('end', $period->getEndDate())