diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/NotificationRepository.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/NotificationRepository.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/NotificationRepository.php b/src/Wallabag/CoreBundle/Repository/NotificationRepository.php new file mode 100644 index 00000000..6d6938ae --- /dev/null +++ b/src/Wallabag/CoreBundle/Repository/NotificationRepository.php | |||
@@ -0,0 +1,26 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Repository; | ||
4 | |||
5 | use Doctrine\ORM\EntityRepository; | ||
6 | |||
7 | class NotificationRepository extends EntityRepository | ||
8 | { | ||
9 | public function markAllAsReadForUser($userId) | ||
10 | { | ||
11 | return $this->getEntityManager()->createQueryBuilder() | ||
12 | ->update('WallabagCoreBundle:Notification', 'n') | ||
13 | ->set('n.read', true) | ||
14 | ->where('n.user = :userId')->setParameter('userId', $userId) | ||
15 | ->getQuery() | ||
16 | ->getResult(); | ||
17 | } | ||
18 | |||
19 | public function getBuilderForNotificationsByUser($userId) | ||
20 | { | ||
21 | return $this->createQueryBuilder('n') | ||
22 | ->andWhere('n.user = :userId')->setParameter('userId', $userId) | ||
23 | ->orderBy('n.timestamp', 'desc') | ||
24 | ; | ||
25 | } | ||
26 | } | ||