Show events for today
This commit is contained in:
parent
0f34bb4242
commit
2fce8b3cfd
3 changed files with 11 additions and 3 deletions
|
@ -34,13 +34,15 @@ class EventController extends Controller
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
$now = new \DateTime();
|
||||||
|
$now->setTime(0,0,0);
|
||||||
/** @var QueryBuilder $qb */
|
/** @var QueryBuilder $qb */
|
||||||
$qb = $em->createQueryBuilder();
|
$qb = $em->createQueryBuilder();
|
||||||
$qb ->select(array('e'))
|
$qb ->select(array('e'))
|
||||||
->from('CalciferBundle:Event', 'e')
|
->from('CalciferBundle:Event', 'e')
|
||||||
->where('e.startdate >= :startdate')
|
->where('e.startdate >= :startdate')
|
||||||
->orderBy('e.startdate')
|
->orderBy('e.startdate')
|
||||||
->setParameter('startdate',new \DateTime());
|
->setParameter('startdate',$now);
|
||||||
$entities = $qb->getQuery()->execute();
|
$entities = $qb->getQuery()->execute();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
|
@ -56,6 +56,9 @@ class LocationController extends Controller
|
||||||
|
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
$now = new \DateTime();
|
||||||
|
$now->setTime(0,0,0);
|
||||||
|
|
||||||
/** @var QueryBuilder $qb */
|
/** @var QueryBuilder $qb */
|
||||||
$qb = $em->createQueryBuilder();
|
$qb = $em->createQueryBuilder();
|
||||||
$qb ->select(array('e'))
|
$qb ->select(array('e'))
|
||||||
|
@ -63,7 +66,7 @@ class LocationController extends Controller
|
||||||
->where('e.startdate >= :startdate')
|
->where('e.startdate >= :startdate')
|
||||||
->andWhere('e.locations_id = :location')
|
->andWhere('e.locations_id = :location')
|
||||||
->orderBy('e.startdate')
|
->orderBy('e.startdate')
|
||||||
->setParameter('startdate',new \DateTime())
|
->setParameter('startdate',$now)
|
||||||
->setParameter('location',$location->getId());
|
->setParameter('location',$location->getId());
|
||||||
$entities = $qb->getQuery()->execute();
|
$entities = $qb->getQuery()->execute();
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,9 @@ class TagController extends Controller
|
||||||
throw $this->createNotFoundException('Unable to find tag entity.');
|
throw $this->createNotFoundException('Unable to find tag entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$now = new \DateTime();
|
||||||
|
$now->setTime(0,0,0);
|
||||||
|
|
||||||
/** @var QueryBuilder $qb */
|
/** @var QueryBuilder $qb */
|
||||||
$qb = $em->createQueryBuilder();
|
$qb = $em->createQueryBuilder();
|
||||||
$qb ->select(array('e'))
|
$qb ->select(array('e'))
|
||||||
|
@ -61,7 +64,7 @@ class TagController extends Controller
|
||||||
->join('e.tags', 't', 'WITH', $qb->expr()->in('t.id', $tag->getId()))
|
->join('e.tags', 't', 'WITH', $qb->expr()->in('t.id', $tag->getId()))
|
||||||
->where('e.startdate >= :startdate')
|
->where('e.startdate >= :startdate')
|
||||||
->orderBy('e.startdate')
|
->orderBy('e.startdate')
|
||||||
->setParameter('startdate',new \DateTime());
|
->setParameter('startdate',$now);
|
||||||
$entities = $qb->getQuery()->execute();
|
$entities = $qb->getQuery()->execute();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
Reference in a new issue