aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/AnnotationBundle/Controller
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2017-05-31 09:31:18 +0200
committerThomas Citharel <tcit@tcit.fr>2017-06-23 10:08:54 +0200
commitbf6c0346d8d35a719dd1bff1cb4d573d422f99ff (patch)
tree04fb80e20ad1cffacb72357a632a9afe2ec058cb /src/Wallabag/AnnotationBundle/Controller
parentd6d3f4ec3698effd1d4b063e295341791bdcf7d7 (diff)
downloadwallabag-bf6c0346d8d35a719dd1bff1cb4d573d422f99ff.tar.gz
wallabag-bf6c0346d8d35a719dd1bff1cb4d573d422f99ff.tar.zst
wallabag-bf6c0346d8d35a719dd1bff1cb4d573d422f99ff.zip
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'src/Wallabag/AnnotationBundle/Controller')
-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);