Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public function getNotificationsCount(DatabaseNotifiableInterface $user, $status = '') |
||
11 | { |
||
12 | $dq = $this->createQueryBuilder('n') |
||
13 | ->select('count(n.id)') |
||
14 | ->andWhere('n.notifiable = ' . $user->getId()); |
||
15 | |||
16 | switch ($status) { |
||
17 | case 'read': |
||
18 | $dq->andWhere('n.readAt IS NOT NULL'); |
||
19 | break; |
||
20 | case 'unread': |
||
21 | $dq->andWhere('n.readAt IS NULL'); |
||
22 | break; |
||
23 | } |
||
24 | |||
25 | $count = $dq->getQuery()->getSingleScalarResult(); |
||
26 | |||
27 | return $count; |
||
28 | } |
||
29 | |||
38 |