From 0d48dfce6dee0d022b156cfeda1888e16acc47ba Mon Sep 17 00:00:00 2001
From: Jeremy Guiselin <jeremy.guiselin@student.ecp.fr>
Date: Mon, 23 Jan 2017 14:02:15 +0100
Subject: [PATCH] notifications desc

---
 .../Repository/NotificationOnDeviceRepository.php              | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/BackendBundle/Repository/NotificationOnDeviceRepository.php b/src/BackendBundle/Repository/NotificationOnDeviceRepository.php
index 7410fab..9d3286b 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();
     }
-- 
GitLab