Skip to content

Instantly share code, notes, and snippets.

@cagataycali
Created September 19, 2015 10:12
Show Gist options
  • Save cagataycali/de9c485045a5cdc64424 to your computer and use it in GitHub Desktop.
Save cagataycali/de9c485045a5cdc64424 to your computer and use it in GitHub Desktop.
if(null !== $today) {
$today0 = new \DateTime($today->format("Y-m-d"));
$today23 = new \DateTime($today->format("Y-m-d"));
$today0->setTime(0,0,0);
$today23->setTime(23,59,59);
$qb->where($qb->expr()->orX(
$qb->expr()->orX(
$qb->expr()->between('r.dateFrom', ':today0', ':today23'),
$qb->expr()->between('r.dateTo', ':today0', ':today23')
),
$qb->expr()->andX(
$qb->expr()->lte('r.dateFrom', ':today23'),
$qb->expr()->gte('r.dateTo', ':today0')
)
));
$qb->setParameter('today0', $today0);
$qb->setParameter('today23', $today23);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment