]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/NotificationsController.php
changes and default actions
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / NotificationsController.php
index 24870b37c318b40cc376bb22b94c89aa226f67fb..0717ff475fca34c4f1bd9351e7e872c9eda496db 100644 (file)
@@ -6,6 +6,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
 use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
+use Wallabag\CoreBundle\Entity\Notification;
 
 class NotificationsController extends Controller
 {
@@ -35,4 +36,22 @@ class NotificationsController extends Controller
 
         return $this->redirectToRoute('notifications-all');
     }
+
+    /**
+     * @Route("/notifications/read/{notification}", name="notification-archive")
+     *
+     * @param Notification $notification
+     * @return Response
+     */
+    public function markNotificationsAsReadAction(Notification $notification)
+    {
+        $em = $this->getDoctrine()->getManager();
+
+        $notification->setRead(true);
+
+        $em->persist($notification);
+        $em->flush();
+
+        return $this->redirectToRoute('notifications-all');
+    }
 }