]>
Commit | Line | Data |
---|---|---|
22a4b20e TC |
1 | <?php |
2 | ||
3 | namespace Wallabag\CoreBundle\Controller; | |
4 | ||
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 | ||
10 | class NotificationsController extends Controller | |
11 | { | |
12 | /** | |
13 | * @param Request $request | |
14 | * | |
15 | * @Route("/notifications", name="notifications-all") | |
16 | * | |
17 | * @return \Symfony\Component\HttpFoundation\Response | |
18 | */ | |
19 | public function getAllNotificationsAction(Request $request) | |
20 | { | |
21 | $notifications = $this->getDoctrine()->getRepository('WallabagCoreBundle:Notification')->findByUser($this->getUser()); | |
22 | ||
23 | return $this->render('WallabagCoreBundle:Notification:notifications.html.twig', ['notifications' => $notifications]); | |
24 | } | |
25 | ||
26 | /** | |
27 | * @Route("/notifications/readall", name="notification-archive-all") | |
28 | * | |
29 | * @param Request $request | |
30 | * @return Response | |
31 | */ | |
32 | public function markAllNotificationsAsReadAction(Request $request) | |
33 | { | |
34 | $this->getDoctrine()->getRepository('WallabagCoreBundle:Notification')->markAllAsReadForUser($this->getUser()->getId()); | |
35 | ||
36 | return $this->redirectToRoute('notifications-all'); | |
37 | } | |
38 | } |