X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/airbundle/blobdiff_plain/f201fefc56d4ed8ba2257f7aed1b5cf4ae91b268..b784ac8165e5b04c470f0ebef4c909272bb572ac:/Repository/SessionRepository.php diff --git a/Repository/SessionRepository.php b/Repository/SessionRepository.php index 9ffaf02..b7471eb 100644 --- a/Repository/SessionRepository.php +++ b/Repository/SessionRepository.php @@ -42,4 +42,23 @@ class SessionRepository extends \Doctrine\ORM\EntityRepository { //Send result return $ret; } + + /** + * Find sessions by location and date period + * + * @param $location The location + * @param $period The date period + */ + public function findAllByLocationDatePeriod($location, $period) { + //Fetch sessions + $ret = $this->getEntityManager() + ->createQuery('SELECT s FROM RapsysAirBundle:Session s WHERE (s.location = :location AND s.date BETWEEN :begin AND :end)') + ->setParameter('location', $location) + ->setParameter('begin', $period->getStartDate()) + ->setParameter('end', $period->getEndDate()) + ->getResult(); + + //Send result + return $ret; + } }