show datas ordered by most recent

This commit is contained in:
Simon Vieille 2020-04-28 16:08:00 +02:00
parent 0f56665b6d
commit e7b7e07d98
Signed by: deblan
GPG Key ID: 03383D15A1D31745
1 changed files with 1 additions and 1 deletions

View File

@ -22,7 +22,7 @@ class HygrometryRepository extends ServiceEntityRepository
public function findByDateRange(\DateTime $fromDate, \DateTime $toDate, ?int $limit = null, string $dateOrder = 'ASC')
{
$query = $this->createQueryBuilder('h')
->orderBy('h.date')
->orderBy('h.date', $dateOrder)
->andWhere('h.date >= :fromDate')
->andWhere('h.date <= :toDate')
->setParameter('fromDate', $fromDate->format('Y-m-d H:i:s'))