aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-10-08 13:31:08 +0200
committerGitHub <noreply@github.com>2016-10-08 13:31:08 +0200
commite07c25a1adb2f89c5f57656e24a054ddd3a45df7 (patch)
treece4e9757d816c5ecd5e7f1c2420b5301b7c8a137 /src/Wallabag/CoreBundle/Controller
parentd9b0673dbb1138e805e039610cef893e49abe3d8 (diff)
parentac8cf632bb3a225c1b69d16e714ff60a2e988c89 (diff)
downloadwallabag-e07c25a1adb2f89c5f57656e24a054ddd3a45df7.tar.gz
wallabag-e07c25a1adb2f89c5f57656e24a054ddd3a45df7.tar.zst
wallabag-e07c25a1adb2f89c5f57656e24a054ddd3a45df7.zip
Merge pull request #2397 from wallabag/api-orphan-tags
Ensure orphan tag are remove in API
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index 623a6146..c5746734 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -63,10 +63,12 @@ class TagController extends Controller
63 $entry->removeTag($tag); 63 $entry->removeTag($tag);
64 $em = $this->getDoctrine()->getManager(); 64 $em = $this->getDoctrine()->getManager();
65 $em->flush(); 65 $em->flush();
66 if (count($tag->getEntries()) == 0) { 66
67 // remove orphan tag in case no entries are associated to it
68 if (count($tag->getEntries()) === 0) {
67 $em->remove($tag); 69 $em->remove($tag);
70 $em->flush();
68 } 71 }
69 $em->flush();
70 72
71 $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer')); 73 $redirectUrl = $this->get('wallabag_core.helper.redirect')->to($request->headers->get('referer'));
72 74