3 namespace Wallabag\CoreBundle\Controller
;
5 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route
;
6 use Symfony\Bundle\FrameworkBundle\Controller\Controller
;
7 use Symfony\Component\HttpFoundation\Request
;
8 use Symfony\Component\HttpFoundation\Response
;
9 use Wallabag\CoreBundle\Entity\Notification
;
11 class NotificationsController
extends Controller
14 * @param Request $request
16 * @Route("/notifications", name="notifications-all")
18 * @return \Symfony\Component\HttpFoundation\Response
20 public function getAllNotificationsAction(Request
$request)
22 $notifications = $this->getDoctrine()->getRepository('WallabagCoreBundle:Notification')->findByUser($this->getUser());
24 return $this->render('WallabagCoreBundle:Notification:notifications.html.twig', ['notifications' => $notifications]);
28 * @Route("/notifications/readall", name="notification-archive-all")
30 * @param Request $request
33 public function markAllNotificationsAsReadAction(Request
$request)
35 $this->getDoctrine()->getRepository('WallabagCoreBundle:Notification')->markAllAsReadForUser($this->getUser()->getId());
37 return $this->redirectToRoute('notifications-all');
41 * @Route("/notifications/read/{notification}", name="notification-archive")
43 * @param Notification $notification
46 public function markNotificationsAsReadAction(Notification
$notification)
48 $em = $this->getDoctrine()->getManager();
50 $notification->setRead(true);
52 $em->persist($notification);
55 return $this->redirectToRoute('notifications-all');