+ ]);
+ }
+
+ /**
+ * Removes tag from entry.
+ *
+ * @Route("/remove-tag/{entry}/{tag}", requirements={"entry" = "\d+", "tag" = "\d+"}, name="remove_tag")
+ *
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag)
+ {
+ $entry->removeTag($tag);
+ $em = $this->getDoctrine()->getManager();
+ $em->flush();
+
+ // remove orphan tag in case no entries are associated to it
+ if (0 === \count($tag->getEntries())) {
+ $em->remove($tag);
+ $em->flush();
+ }
+
+ $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'), '', true);
+
+ return $this->redirect($redirectUrl);