Skip to content

Commit 2f0fafc

Browse files
committed
Search between datetimes
1 parent 9f0b8c1 commit 2f0fafc

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/Provider/DoctrineProvider.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,11 @@ public function findBy($data)
256256
$qb->setParameter('contains', '%' . $data['search'] . '%');
257257
}
258258

259-
if (isset($data['from']) && $data['from'] !== null) {
260-
$qb->andWhere('p.created >= :from');
259+
if (isset($data['from']) && $data['from'] !== null && isset($data['to']) && $data['to'] !== null) {
260+
$qb->andWhere('p.created BETWEEN :from AND :to');
261261
$qb->setParameter('from', $data['from']);
262-
}
263-
264-
if (isset($data['to']) && $data['to'] !== null) {
265-
$qb->andWhere('p.created <= :to');
266262
$qb->setParameter('to', $data['to']);
267-
}
263+
}
268264

269265
return $qb->getQuery();
270266
}

0 commit comments

Comments
 (0)