]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Controller/TagController.php
WIP
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Controller / TagController.php
index a8b1eaddb9a045008fb12adcce30695528c21fc0..6cc78458a49445e567b418664f3a0e5364f91595 100644 (file)
@@ -9,6 +9,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 use Symfony\Component\HttpFoundation\Request;
 use Wallabag\CoreBundle\Entity\Entry;
 use Wallabag\CoreBundle\Entity\Tag;
+use Wallabag\CoreBundle\Event\Activity\Actions\Entry\EntryTaggedEvent;
 use Wallabag\CoreBundle\Form\Type\NewTagType;
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
 
@@ -37,6 +38,8 @@ class TagController extends Controller
             $em->persist($entry);
             $em->flush();
 
+            $this->get('event_dispatcher')->dispatch(EntryTaggedEvent::NAME, new EntryTaggedEvent($entry, $tags));
+
             $this->get('session')->getFlashBag()->add(
                 'notice',
                 'flashes.tag.notice.tag_added'
@@ -64,6 +67,8 @@ class TagController extends Controller
         $em = $this->getDoctrine()->getManager();
         $em->flush();
 
+        $this->get('event_dispatcher')->dispatch(EntryTaggedEvent::NAME, new EntryTaggedEvent($entry, $tag), true);
+
         // remove orphan tag in case no entries are associated to it
         if (count($tag->getEntries()) === 0) {
             $em->remove($tag);