| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | public function findUnread(string $ownerId = null): Collection |
||
| 13 | { |
||
| 14 | $queryBuilder = $this |
||
| 15 | ->createQueryBuilder('notification') |
||
| 16 | ->where('notification.read = :read') |
||
| 17 | ->setParameter('read', false) |
||
| 18 | ->addOrderBy('notification.updatedAt', 'desc') |
||
| 19 | ->addOrderBy('notification.id', 'desc') |
||
| 20 | ; |
||
| 21 | |||
| 22 | if ($ownerId) { |
||
| 23 | $queryBuilder |
||
| 24 | ->andWhere('notification.ownerId = :owner_id') |
||
| 25 | ->setParameter('owner_id', $ownerId) |
||
| 26 | ; |
||
| 27 | } |
||
| 28 | |||
| 29 | return new ArrayCollection($queryBuilder->getQuery()->getResult()); |
||
| 30 | } |
||
| 37 |