X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FTagController.php;h=56e5195c1fc0075af5d9896416a5c9f5e5965ee3;hb=439b36323e37f669b056cc5228c44bb91196256c;hp=ff4d64a8f4319653961310bbf5ba46d75a30c419;hpb=5c895a7fd15822856fb407910264c5d95e1e223c;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index ff4d64a8..56e5195c 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -43,7 +43,7 @@ class TagController extends Controller $this->get('session')->getFlashBag()->add( 'notice', - 'Tag added' + 'flashes.tag.notice.tag_added' ); return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); @@ -55,6 +55,26 @@ class TagController extends Controller )); } + /** + * 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(); + if (count($tag->getEntries()) == 0) { + $em->remove($tag); + } + $em->flush(); + + return $this->redirect($request->headers->get('referer')); + } + /** * Shows tags for current user. *