X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/58242917a50ec39071529953e77343fd3eb6dda0..800d480c213b9c44b8e1088213f65765b1e5ef16:/Repository/SessionRepository.php?ds=inline

diff --git a/Repository/SessionRepository.php b/Repository/SessionRepository.php
index e295bfd..b7471eb 100644
--- a/Repository/SessionRepository.php
+++ b/Repository/SessionRepository.php
@@ -31,7 +31,7 @@ class SessionRepository extends \Doctrine\ORM\EntityRepository {
 	 *
 	 * @param $period The date period
 	 */
-	public function findByDatePeriod($period) {
+	public function findAllByDatePeriod($period) {
 		//Fetch sessions
 		$ret = $this->getEntityManager()
 			->createQuery('SELECT s FROM RapsysAirBundle:Session s WHERE s.date BETWEEN :begin AND :end')
@@ -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;
+	}
 }