]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Repository/NotificationRepository.php
Notifications
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Repository / NotificationRepository.php
CommitLineData
378aaefb
TC
1<?php
2
3namespace Wallabag\CoreBundle\Repository;
4
5use Doctrine\ORM\EntityRepository;
6
7class 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}