diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2020-04-06 16:11:05 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2020-04-06 16:11:05 +0200 |
commit | a07872238b8fb743d7a8e09531d367454e8ebe3f (patch) | |
tree | 3c8ce4588df04c8de159d74d5ba756eff9993052 /src/Wallabag/ApiBundle | |
parent | fbfeb200626cc1f985d3246be35a6b00a4ed89d5 (diff) | |
download | wallabag-a07872238b8fb743d7a8e09531d367454e8ebe3f.tar.gz wallabag-a07872238b8fb743d7a8e09531d367454e8ebe3f.tar.zst wallabag-a07872238b8fb743d7a8e09531d367454e8ebe3f.zip |
Fixed bug when we delete entry via API
Fixes #4291
Diffstat (limited to 'src/Wallabag/ApiBundle')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/EntryRestController.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index c09fdaeb..5158171e 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -239,12 +239,12 @@ class EntryRestController extends WallabagRestController | |||
239 | $results[$key]['url'] = $url; | 239 | $results[$key]['url'] = $url; |
240 | 240 | ||
241 | if (false !== $entry) { | 241 | if (false !== $entry) { |
242 | // entry deleted, dispatch event about it! | ||
243 | $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); | ||
244 | |||
242 | $em = $this->getDoctrine()->getManager(); | 245 | $em = $this->getDoctrine()->getManager(); |
243 | $em->remove($entry); | 246 | $em->remove($entry); |
244 | $em->flush(); | 247 | $em->flush(); |
245 | |||
246 | // entry deleted, dispatch event about it! | ||
247 | $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); | ||
248 | } | 248 | } |
249 | 249 | ||
250 | $results[$key]['entry'] = $entry instanceof Entry ? true : false; | 250 | $results[$key]['entry'] = $entry instanceof Entry ? true : false; |
@@ -610,13 +610,13 @@ class EntryRestController extends WallabagRestController | |||
610 | $response = $this->sendResponse($e); | 610 | $response = $this->sendResponse($e); |
611 | } | 611 | } |
612 | 612 | ||
613 | // entry deleted, dispatch event about it! | ||
614 | $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); | ||
615 | |||
613 | $em = $this->getDoctrine()->getManager(); | 616 | $em = $this->getDoctrine()->getManager(); |
614 | $em->remove($entry); | 617 | $em->remove($entry); |
615 | $em->flush(); | 618 | $em->flush(); |
616 | 619 | ||
617 | // entry deleted, dispatch event about it! | ||
618 | $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); | ||
619 | |||
620 | return $response; | 620 | return $response; |
621 | } | 621 | } |
622 | 622 | ||