init without trunk
This commit is contained in:
parent
ed24ac4994
commit
bb809e7233
14652 changed files with 177862 additions and 94817 deletions
47
src/AppBundle/Entity/FewoLodgingRepository.php
Normal file
47
src/AppBundle/Entity/FewoLodgingRepository.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
use Doctrine\ORM\Query\Expr\OrderBy;
|
||||
|
||||
/**
|
||||
* FewoLodgingRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class FewoLodgingRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
/**
|
||||
* @param FewoLodging $lodging
|
||||
*
|
||||
* @return FewoSeason|null
|
||||
*/
|
||||
public function findLatestSeasonEndForLodging($lodging)
|
||||
{
|
||||
$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->addOrderBy('s.toDate', 'DESC');
|
||||
$qb->setMaxResults(1);
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue