diff options
author | Thomas Citharel <tcit@tcit.fr> | 2017-05-31 09:31:18 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2017-06-23 10:08:54 +0200 |
commit | bf6c0346d8d35a719dd1bff1cb4d573d422f99ff (patch) | |
tree | 04fb80e20ad1cffacb72357a632a9afe2ec058cb /src/Wallabag/AnnotationBundle/Controller | |
parent | d6d3f4ec3698effd1d4b063e295341791bdcf7d7 (diff) | |
download | wallabag-bf6c0346d8d35a719dd1bff1cb4d573d422f99ff.tar.gz wallabag-bf6c0346d8d35a719dd1bff1cb4d573d422f99ff.tar.zst wallabag-bf6c0346d8d35a719dd1bff1cb4d573d422f99ff.zip |
WIPfederation
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'src/Wallabag/AnnotationBundle/Controller')
-rw-r--r-- | src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php | 8 |
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; | |||
10 | use Wallabag\AnnotationBundle\Form\EditAnnotationType; | 10 | use Wallabag\AnnotationBundle\Form\EditAnnotationType; |
11 | use Wallabag\AnnotationBundle\Form\NewAnnotationType; | 11 | use Wallabag\AnnotationBundle\Form\NewAnnotationType; |
12 | use Wallabag\CoreBundle\Entity\Entry; | 12 | use Wallabag\CoreBundle\Entity\Entry; |
13 | use Wallabag\CoreBundle\Event\Activity\Actions\Annotation\AnnotationCreatedEvent; | ||
14 | use Wallabag\CoreBundle\Event\Activity\Actions\Annotation\AnnotationDeletedEvent; | ||
15 | use Wallabag\CoreBundle\Event\Activity\Actions\Annotation\AnnotationEditedEvent; | ||
13 | 16 | ||
14 | class WallabagAnnotationController extends FOSRestController | 17 | class 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); |