+ }
+
+ /**
+ * Changes read status for an entry
+ *
+ * @param Request $request
+ * @param Entries $entry
+ * @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry")
+ * @return \Symfony\Component\HttpFoundation\RedirectResponse
+ */
+ public function toggleArchiveAction(Request $request, Entries $entry)
+ {
+ $entry->toggleArchive();
+ $this->getDoctrine()->getManager()->flush();
+
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ 'Entry archived'
+ );
+
+ return $this->redirect($request->headers->get('referer'));
+ }
+
+ /**
+ * Changes favorite status for an entry
+ *
+ * @param Request $request
+ * @param Entries $entry
+ * @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry")
+ * @return \Symfony\Component\HttpFoundation\RedirectResponse
+ */
+ public function toggleStarAction(Request $request, Entries $entry)
+ {
+ $entry->toggleStar();
+ $this->getDoctrine()->getManager()->flush();
+
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ 'Entry starred'
+ );
+
+ return $this->redirect($request->headers->get('referer'));
+ }
+
+ /**
+ * Deletes entry
+ *
+ * @param Request $request
+ * @param Entries $entry
+ * @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry")
+ * @return \Symfony\Component\HttpFoundation\RedirectResponse
+ */
+ public function deleteEntryAction(Request $request, Entries $entry)
+ {
+ $em = $this->getDoctrine()->getEntityManager();
+ $em->remove($entry);
+ $em->flush();
+
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ 'Entry deleted'
+ );