/** * Mark user notifications as viewed * * @param int|null $id If null, all notifications will be marked as viewed * * @return JsonResponse */ public function markAsViewedAction($id) { $user = $this->userContext->getUser(); if (null !== $user) { $this->userNotifRepository->markAsViewed($user, $id); } return new JsonResponse(); }
/** * Marks given user notifications as viewed * * @param UserInterface $user The user * @param int|null $id If null, all notifications will be marked as viewed * * @deprecated will be removed in 1.7. Please use Pim\Bundle\NotificationBundle\Entity\Repository\UserNotificationRepository::markAsViewed() */ public function markAsViewed(UserInterface $user, $id) { $this->userNotifRepository->markAsViewed($user, $id); }