From bf6c0346d8d35a719dd1bff1cb4d573d422f99ff Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 31 May 2017 09:31:18 +0200 Subject: WIP Signed-off-by: Thomas Citharel --- .../AnnotationBundle/Controller/WallabagAnnotationController.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php') 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; use Wallabag\AnnotationBundle\Form\EditAnnotationType; use Wallabag\AnnotationBundle\Form\NewAnnotationType; use Wallabag\CoreBundle\Entity\Entry; +use Wallabag\CoreBundle\Event\Activity\Actions\Annotation\AnnotationCreatedEvent; +use Wallabag\CoreBundle\Event\Activity\Actions\Annotation\AnnotationDeletedEvent; +use Wallabag\CoreBundle\Event\Activity\Actions\Annotation\AnnotationEditedEvent; class WallabagAnnotationController extends FOSRestController { @@ -64,6 +67,8 @@ class WallabagAnnotationController extends FOSRestController $em->persist($annotation); $em->flush(); + $this->get('event_dispatcher')->dispatch(AnnotationCreatedEvent::NAME, new AnnotationCreatedEvent($annotation)); + $json = $this->get('serializer')->serialize($annotation, 'json'); return JsonResponse::fromJsonString($json); @@ -100,6 +105,7 @@ class WallabagAnnotationController extends FOSRestController $em->flush(); $json = $this->get('serializer')->serialize($annotation, 'json'); + $this->get('event_dispatcher')->dispatch(AnnotationEditedEvent::NAME, new AnnotationEditedEvent($annotation)); return JsonResponse::fromJsonString($json); } @@ -124,6 +130,8 @@ class WallabagAnnotationController extends FOSRestController $em->remove($annotation); $em->flush(); + $this->get('event_dispatcher')->dispatch(AnnotationDeletedEvent::NAME, new AnnotationDeletedEvent($annotation)); + $json = $this->get('serializer')->serialize($annotation, 'json'); return (new JsonResponse())->setJson($json); -- cgit v1.2.3