aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/AnnotationBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/AnnotationBundle')
-rw-r--r--src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
index 2b4b0e8d..45fd9cf3 100644
--- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
+++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
@@ -10,6 +10,9 @@ use Wallabag\AnnotationBundle\Entity\Annotation;
10use Wallabag\AnnotationBundle\Form\EditAnnotationType; 10use Wallabag\AnnotationBundle\Form\EditAnnotationType;
11use Wallabag\AnnotationBundle\Form\NewAnnotationType; 11use Wallabag\AnnotationBundle\Form\NewAnnotationType;
12use Wallabag\CoreBundle\Entity\Entry; 12use Wallabag\CoreBundle\Entity\Entry;
13use Wallabag\CoreBundle\Event\Activity\Actions\Annotation\AnnotationCreatedEvent;
14use Wallabag\CoreBundle\Event\Activity\Actions\Annotation\AnnotationDeletedEvent;
15use Wallabag\CoreBundle\Event\Activity\Actions\Annotation\AnnotationEditedEvent;
13 16
14class WallabagAnnotationController extends FOSRestController 17class WallabagAnnotationController extends FOSRestController
15{ 18{
@@ -64,6 +67,8 @@ class WallabagAnnotationController extends FOSRestController
64 $em->persist($annotation); 67 $em->persist($annotation);
65 $em->flush(); 68 $em->flush();
66 69
70 $this->get('event_dispatcher')->dispatch(AnnotationCreatedEvent::NAME, new AnnotationCreatedEvent($annotation));
71
67 $json = $this->get('serializer')->serialize($annotation, 'json'); 72 $json = $this->get('serializer')->serialize($annotation, 'json');
68 73
69 return JsonResponse::fromJsonString($json); 74 return JsonResponse::fromJsonString($json);
@@ -100,6 +105,7 @@ class WallabagAnnotationController extends FOSRestController
100 $em->flush(); 105 $em->flush();
101 106
102 $json = $this->get('serializer')->serialize($annotation, 'json'); 107 $json = $this->get('serializer')->serialize($annotation, 'json');
108 $this->get('event_dispatcher')->dispatch(AnnotationEditedEvent::NAME, new AnnotationEditedEvent($annotation));
103 109
104 return JsonResponse::fromJsonString($json); 110 return JsonResponse::fromJsonString($json);
105 } 111 }
@@ -124,6 +130,8 @@ class WallabagAnnotationController extends FOSRestController
124 $em->remove($annotation); 130 $em->remove($annotation);
125 $em->flush(); 131 $em->flush();
126 132
133 $this->get('event_dispatcher')->dispatch(AnnotationDeletedEvent::NAME, new AnnotationDeletedEvent($annotation));
134
127 $json = $this->get('serializer')->serialize($annotation, 'json'); 135 $json = $this->get('serializer')->serialize($annotation, 'json');
128 136
129 return (new JsonResponse())->setJson($json); 137 return (new JsonResponse())->setJson($json);