/**
  * Return the number of unread notifications for the currently logged in user
  *
  * @return int
  */
 public function countNotifications()
 {
     $user = $this->userContext->getUser();
     if (null === $user) {
         return 0;
     }
     return $this->repository->countUnreadForUser($user);
 }
 /**
  * Remove a notification
  *
  * @param UserInterface $user
  * @param int           $id
  *
  * @deprecated will be removed in 1.7. Please use Akeneo\Bundle\StorageUtilsBundle\Doctrine\Common\Remover\BaseRemove::remove()
  */
 public function remove(UserInterface $user, $id)
 {
     $notification = $this->userNotifRepository->findOneBy(['id' => $id, 'user' => $user]);
     if ($notification) {
         $this->userNotifRemover->remove($notification);
     }
 }
 /**
  * Remove a notification
  *
  * @param int $id
  *
  * @return JsonResponse
  */
 public function removeAction($id)
 {
     $user = $this->userContext->getUser();
     if (null !== $user) {
         $notification = $this->userNotifRepository->findOneBy(['id' => $id, 'user' => $user]);
         if ($notification) {
             $this->userNotifRemover->remove($notification);
         }
     }
     return new JsonResponse();
 }