show datas ordered by most recent
This commit is contained in:
parent
0f56665b6d
commit
e7b7e07d98
|
@ -22,7 +22,7 @@ class HygrometryRepository extends ServiceEntityRepository
|
||||||
public function findByDateRange(\DateTime $fromDate, \DateTime $toDate, ?int $limit = null, string $dateOrder = 'ASC')
|
public function findByDateRange(\DateTime $fromDate, \DateTime $toDate, ?int $limit = null, string $dateOrder = 'ASC')
|
||||||
{
|
{
|
||||||
$query = $this->createQueryBuilder('h')
|
$query = $this->createQueryBuilder('h')
|
||||||
->orderBy('h.date')
|
->orderBy('h.date', $dateOrder)
|
||||||
->andWhere('h.date >= :fromDate')
|
->andWhere('h.date >= :fromDate')
|
||||||
->andWhere('h.date <= :toDate')
|
->andWhere('h.date <= :toDate')
|
||||||
->setParameter('fromDate', $fromDate->format('Y-m-d H:i:s'))
|
->setParameter('fromDate', $fromDate->format('Y-m-d H:i:s'))
|
||||||
|
|
Loading…
Reference in a new issue