/**
  * 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->manager->countUnreadForUser($user);
 }
 /**
  * Return the number of unread notifications for the current user
  *
  * @return JsonResponse
  */
 public function countUnreadAction()
 {
     $user = $this->userContext->getUser();
     return new JsonResponse($this->manager->countUnreadForUser($user));
 }