Skip to content

Commit

Permalink
Search between datetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnilya committed Jan 4, 2017
1 parent 9f0b8c1 commit 2f0fafc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Provider/DoctrineProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,11 @@ public function findBy($data)
$qb->setParameter('contains', '%' . $data['search'] . '%');
}

if (isset($data['from']) && $data['from'] !== null) {
$qb->andWhere('p.created >= :from');
if (isset($data['from']) && $data['from'] !== null && isset($data['to']) && $data['to'] !== null) {
$qb->andWhere('p.created BETWEEN :from AND :to');
$qb->setParameter('from', $data['from']);
}

if (isset($data['to']) && $data['to'] !== null) {
$qb->andWhere('p.created <= :to');
$qb->setParameter('to', $data['to']);
}
}

return $qb->getQuery();
}
Expand Down

0 comments on commit 2f0fafc

Please sign in to comment.