diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-02-11 16:49:03 +0100 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-02-11 16:49:03 +0100 |
commit | 9b5edf33a00490b033692efca9987a35225835ba (patch) | |
tree | 73d3c24ecdeab3b65b1ea2ca2d90fe6d31d5780c /src/Wallabag/CoreBundle/Controller | |
parent | 5db084e05b84ac87179336b96b5db9579fa78c67 (diff) | |
parent | e686a76d343a3745c3dfe8010d9e5784e56bb17c (diff) | |
download | wallabag-9b5edf33a00490b033692efca9987a35225835ba.tar.gz wallabag-9b5edf33a00490b033692efca9987a35225835ba.tar.zst wallabag-9b5edf33a00490b033692efca9987a35225835ba.zip |
Merge pull request #1663 from wallabag/v2-remove-tags-from-entry
remove tag from entry #1377
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/TagController.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index ff4d64a8..7b34939d 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -56,6 +56,26 @@ class TagController extends Controller | |||
56 | } | 56 | } |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Removes tag from entry. | ||
60 | * | ||
61 | * @Route("/remove-tag/{entry}/{tag}", requirements={"entry" = "\d+", "tag" = "\d+"}, name="remove_tag") | ||
62 | * | ||
63 | * @return \Symfony\Component\HttpFoundation\Response | ||
64 | */ | ||
65 | public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag) | ||
66 | { | ||
67 | $entry->removeTag($tag); | ||
68 | $em = $this->getDoctrine()->getManager(); | ||
69 | $em->flush(); | ||
70 | if (count($tag->getEntries()) == 0) { | ||
71 | $em->remove($tag); | ||
72 | } | ||
73 | $em->flush(); | ||
74 | |||
75 | return $this->redirect($request->headers->get('referer')); | ||
76 | } | ||
77 | |||
78 | /** | ||
59 | * Shows tags for current user. | 79 | * Shows tags for current user. |
60 | * | 80 | * |
61 | * @Route("/tag/list", name="tag") | 81 | * @Route("/tag/list", name="tag") |