diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-11-03 16:22:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-03 16:22:07 +0100 |
commit | da4136557963018287cae61226e9006c3c741747 (patch) | |
tree | 6bf23c0d32f3780843798ae47c65377ae1ff961a /src/Wallabag/ApiBundle/Controller | |
parent | 816c0940d142f8ec69bdd3f302c9751033cce7e2 (diff) | |
parent | ca08d02f2f17c0e4ec0152a701c540f62713a428 (diff) | |
download | wallabag-da4136557963018287cae61226e9006c3c741747.tar.gz wallabag-da4136557963018287cae61226e9006c3c741747.tar.zst wallabag-da4136557963018287cae61226e9006c3c741747.zip |
Merge pull request #2180 from wallabag/download-pictures
Download pictures
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/WallabagRestController.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index a73d44ca..50652b77 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php | |||
@@ -14,6 +14,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; | |||
14 | use Wallabag\CoreBundle\Entity\Entry; | 14 | use Wallabag\CoreBundle\Entity\Entry; |
15 | use Wallabag\CoreBundle\Entity\Tag; | 15 | use Wallabag\CoreBundle\Entity\Tag; |
16 | use Wallabag\AnnotationBundle\Entity\Annotation; | 16 | use Wallabag\AnnotationBundle\Entity\Annotation; |
17 | use Wallabag\CoreBundle\Event\EntrySavedEvent; | ||
18 | use Wallabag\CoreBundle\Event\EntryDeletedEvent; | ||
17 | 19 | ||
18 | class WallabagRestController extends FOSRestController | 20 | class WallabagRestController extends FOSRestController |
19 | { | 21 | { |
@@ -233,9 +235,11 @@ class WallabagRestController extends FOSRestController | |||
233 | 235 | ||
234 | $em = $this->getDoctrine()->getManager(); | 236 | $em = $this->getDoctrine()->getManager(); |
235 | $em->persist($entry); | 237 | $em->persist($entry); |
236 | |||
237 | $em->flush(); | 238 | $em->flush(); |
238 | 239 | ||
240 | // entry saved, dispatch event about it! | ||
241 | $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); | ||
242 | |||
239 | $json = $this->get('serializer')->serialize($entry, 'json'); | 243 | $json = $this->get('serializer')->serialize($entry, 'json'); |
240 | 244 | ||
241 | return (new JsonResponse())->setJson($json); | 245 | return (new JsonResponse())->setJson($json); |
@@ -308,6 +312,9 @@ class WallabagRestController extends FOSRestController | |||
308 | $this->validateAuthentication(); | 312 | $this->validateAuthentication(); |
309 | $this->validateUserAccess($entry->getUser()->getId()); | 313 | $this->validateUserAccess($entry->getUser()->getId()); |
310 | 314 | ||
315 | // entry deleted, dispatch event about it! | ||
316 | $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); | ||
317 | |||
311 | $em = $this->getDoctrine()->getManager(); | 318 | $em = $this->getDoctrine()->getManager(); |
312 | $em->remove($entry); | 319 | $em->remove($entry); |
313 | $em->flush(); | 320 | $em->flush(); |