| @@ 20-32 (lines=13) @@ | ||
| 17 | * @param $recipientId |
|
| 18 | * @return array of Notification |
|
| 19 | */ |
|
| 20 | public function getNotificationsToSend($recipientId){ |
|
| 21 | $qb = $this->createQueryBuilder() |
|
| 22 | ->select("n") |
|
| 23 | ->from("Azine\EmailBundle\Entity\Notification", "n") |
|
| 24 | ->andWhere("n.sent is null") |
|
| 25 | ->andWhere("n.recipient_id = :recipientId") |
|
| 26 | ->setParameter('recipientId', $recipientId) |
|
| 27 | ->orderBy("n.importance", "desc") |
|
| 28 | ->orderBy("n.template", "asc") |
|
| 29 | ->orderBy("n.title", "asc"); |
|
| 30 | $notifications = $qb->getQuery()->execute(); |
|
| 31 | return $notifications; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Get all notifications that should be sent immediately. |
|
| @@ 39-52 (lines=14) @@ | ||
| 36 | * @param $recipientId |
|
| 37 | * @return array of Notification |
|
| 38 | */ |
|
| 39 | public function getNotificationsToSendImmediately($recipientId){ |
|
| 40 | $qb = $this->createQueryBuilder() |
|
| 41 | ->select("n") |
|
| 42 | ->from("Azine\EmailBundle\Entity\Notification", "n") |
|
| 43 | ->andWhere("n.sent is null") |
|
| 44 | ->andWhere("n.send_immediately = true") |
|
| 45 | ->andWhere("n.recipient_id = :recipientId") |
|
| 46 | ->setParameter('recipientId', $recipientId) |
|
| 47 | ->orderBy("n.importance", "desc") |
|
| 48 | ->orderBy("n.template", "asc") |
|
| 49 | ->orderBy("n.title", "asc"); |
|
| 50 | $notifications = $qb->getQuery()->execute(); |
|
| 51 | return $notifications; |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * Get all recipients with unsent Notifications |
|