]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ApiBundle/Controller/EntryRestController.php
api: copy entry object before sending, to keep id
[github/wallabag/wallabag.git] / src / Wallabag / ApiBundle / Controller / EntryRestController.php
index acca219fec733aabaf809d346dcfbb102c64891a..fc47c479ff4bc0df926c2acde344e239eb0e7366 100644 (file)
@@ -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);
     }
 
     /**