X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FTagController.php;h=64d53f0c7913bc72d509eedc6c62b1b3bfca5f30;hb=fc73222723c7a0c9b577805d3ef51eb96b124b92;hp=fd2069e0315982f7eb42e7ef6a769899dd5804c2;hpb=c997cfcc9c161241a6398b0942a1a869688d807a;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index fd2069e0..64d53f0c 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -20,25 +20,23 @@ class TagController extends Controller */ public function addTagFormAction(Request $request, Entry $entry) { - $tag = new Tag($this->getUser()); + $tag = new Tag(); $form = $this->createForm(new NewTagType(), $tag); $form->handleRequest($request); if ($form->isValid()) { $existingTag = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Tag') - ->findOneByLabelAndUserId($tag->getLabel(), $this->getUser()->getId()); + ->findOneByLabel($tag->getLabel()); $em = $this->getDoctrine()->getManager(); if (is_null($existingTag)) { $entry->addTag($tag); $em->persist($tag); - } else { - if (!$existingTag->hasEntry($entry)) { - $entry->addTag($existingTag); - $em->persist($existingTag); - } + } elseif (!$existingTag->hasEntry($entry)) { + $entry->addTag($existingTag); + $em->persist($existingTag); } $em->flush();