diff --git a/src/BackendBundle/Repository/NotificationOnDeviceRepository.php b/src/BackendBundle/Repository/NotificationOnDeviceRepository.php index 7410fab47731c84e669613486dae878d0398c637..9d3286bf3b739492781abf8252d0eecee42cef13 100644 --- a/src/BackendBundle/Repository/NotificationOnDeviceRepository.php +++ b/src/BackendBundle/Repository/NotificationOnDeviceRepository.php @@ -13,6 +13,7 @@ use BackendBundle\Entity\Device; use BackendBundle\Entity\Notification; use BackendBundle\Entity\NotificationOnDevice; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query\Expr\Join; class NotificationOnDeviceRepository extends EntityRepository { @@ -21,10 +22,12 @@ class NotificationOnDeviceRepository extends EntityRepository return $this->createQueryBuilder('s') ->where('s.notification IN (:notifications)') ->andWhere('s.device = :device') + ->join('s.notification', 'n', Join::WITH, 's.notification = n') ->setParameters([ 'device' => $device, 'notifications' => $notifications ]) + ->orderBy('n.date', 'DESC') ->getQuery() ->getResult(); }