Show events for today

This commit is contained in:
Tim Schumacher 2014-07-11 20:04:43 +02:00
parent 0f34bb4242
commit 2fce8b3cfd
3 changed files with 11 additions and 3 deletions

View file

@ -34,13 +34,15 @@ class EventController extends Controller
{
$em = $this->getDoctrine()->getManager();
$now = new \DateTime();
$now->setTime(0,0,0);
/** @var QueryBuilder $qb */
$qb = $em->createQueryBuilder();
$qb ->select(array('e'))
->from('CalciferBundle:Event', 'e')
->where('e.startdate >= :startdate')
->orderBy('e.startdate')
->setParameter('startdate',new \DateTime());
->setParameter('startdate',$now);
$entities = $qb->getQuery()->execute();
return array(

View file

@ -56,6 +56,9 @@ class LocationController extends Controller
$em = $this->getDoctrine()->getManager();
$now = new \DateTime();
$now->setTime(0,0,0);
/** @var QueryBuilder $qb */
$qb = $em->createQueryBuilder();
$qb ->select(array('e'))
@ -63,7 +66,7 @@ class LocationController extends Controller
->where('e.startdate >= :startdate')
->andWhere('e.locations_id = :location')
->orderBy('e.startdate')
->setParameter('startdate',new \DateTime())
->setParameter('startdate',$now)
->setParameter('location',$location->getId());
$entities = $qb->getQuery()->execute();

View file

@ -54,6 +54,9 @@ class TagController extends Controller
throw $this->createNotFoundException('Unable to find tag entity.');
}
$now = new \DateTime();
$now->setTime(0,0,0);
/** @var QueryBuilder $qb */
$qb = $em->createQueryBuilder();
$qb ->select(array('e'))
@ -61,7 +64,7 @@ class TagController extends Controller
->join('e.tags', 't', 'WITH', $qb->expr()->in('t.id', $tag->getId()))
->where('e.startdate >= :startdate')
->orderBy('e.startdate')
->setParameter('startdate',new \DateTime());
->setParameter('startdate',$now);
$entities = $qb->getQuery()->execute();
return array(