From f5ea67e4cf8e415530d8c09e1b22c66c7064b3c6 Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Sun, 17 Dec 2017 21:05:25 +0100 Subject: api: copy entry object before sending, to keep id Workaround for https://github.com/wallabag/android-app/issues/646 Signed-off-by: Kevin Decherf --- src/Wallabag/ApiBundle/Controller/EntryRestController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index acca219f..fc47c479 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -575,6 +575,9 @@ class EntryRestController extends WallabagRestController $this->validateAuthentication(); $this->validateUserAccess($entry->getUser()->getId()); + // We copy $entry to keep id in returned object + $e = $entry; + $em = $this->getDoctrine()->getManager(); $em->remove($entry); $em->flush(); @@ -582,7 +585,7 @@ class EntryRestController extends WallabagRestController // entry deleted, dispatch event about it! $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); - return $this->sendResponse($entry); + return $this->sendResponse($e); } /** -- cgit v1.2.3