use Symfony\Component\HttpFoundation\Request;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;
+use Wallabag\CoreBundle\Event\EntryTaggedEvent;
use Wallabag\CoreBundle\Form\Type\NewTagType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
- $this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
+ $tags = $this->get('wallabag_core.tags_assigner')->assignTagsToEntry(
$entry,
$form->get('label')->getData()
);
$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'
$em = $this->getDoctrine()->getManager();
$em->flush();
+ $this->get('event_dispatcher')->dispatch(EntryTaggedEvent::NAME, new EntryTaggedEvent($entry, $tag));
+
// remove orphan tag in case no entries are associated to it
if (count($tag->getEntries()) === 0) {
$em->remove($tag);