]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/TagController.php
TagController: fix duplicated tags when renaming them
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / TagController.php
index a6ad131ff569a3dd431cbd226d60d0a90648bc83..c228c27a9f8c1018bdbef3f3c03e190d1154ce8e 100644 (file)
@@ -152,6 +152,10 @@ class TagController extends Controller
         $form->handleRequest($request);
 
         if ($form->isSubmitted() && $form->isValid()) {
+            $newTagLabel = $form->get('label')->getData();
+            $newTag = new Tag();
+            $newTag->setLabel($newTagLabel);
+
             $entries = $this->get('wallabag_core.entry_repository')->findAllByTagId(
                 $this->getUser()->getId(),
                 $tag->getId()
@@ -159,7 +163,8 @@ class TagController extends Controller
             foreach ($entries as $entry) {
                 $this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
                     $entry,
-                    $form->get('label')->getData()
+                    $newTagLabel,
+                    [$newTag]
                 );
                 $entry->removeTag($tag);
             }