This commit is contained in:
Kevin Adametz 2019-02-06 15:11:58 +01:00
parent 98bd71c760
commit 8b2ec705c9
83 changed files with 3467 additions and 1214 deletions

View file

@ -28,4 +28,20 @@ class FewoLodgingRepository extends \Doctrine\ORM\EntityRepository
return $qb->getQuery()->getOneOrNullResult();
}
public function findSeasonForLodgingBy($lodging, $fromDate)
{
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('s');
$qb->from('AppBundle:FewoSeason', 's');
$qb->innerJoin('s.prices', 'p');
$qb->where($qb->expr()->eq('p.lodging', $lodging->getId()));
$qb->andWhere('s.fromDate <= :fromDate');
$qb->andWhere('s.toDate >= :fromDate');
$qb->setParameter('fromDate', $fromDate);
$qb->addOrderBy('s.fromDate', 'DESC');
$qb->setMaxResults(1);
return $qb->getQuery()->getOneOrNullResult();
}
}