]>
Commit | Line | Data |
---|---|---|
378aaefb TC |
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 | } |