예제 #1
0
 /**
  * @param int $notificationId
  * @return Notification
  */
 protected function getNotification($notificationId)
 {
     $notificationEntity = $this->notificationProvider->getById($notificationId);
     if (empty($notification)) {
         throw new NotFoundException(sprintf('Notification with id %d does not exists', $notificationId));
     }
     $notification = $this->notificationMapper->mapEntityToModel($notificationEntity);
     return $notification;
 }
 /**
  * REST GET item
  *
  * @ApiDoc(
  *   description="Get notification by id",
  *   output = "Zbox\UnifiedPushBundle\Entity\Notification",
  *   statusCodes = {
  *     200 = "Returned when successful",
  *     404 = "Returned when the notification is not found"
  *   }
  * )
  *
  * @Annotations\View(templateVar="notification")
  *
  * @param int     $id      the notification id
  * @return Response
  */
 public function getByIdAction($id)
 {
     $notification = $this->notificationProvider->getById($id);
     if (false === $notification) {
         throw $this->createNotFoundException("Notification does not exist.");
     }
     return new View($notification);
 }