aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Controller
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2017-12-17 21:05:25 +0100
committerKevin Decherf <kevin@kdecherf.com>2017-12-17 21:07:46 +0100
commitf5ea67e4cf8e415530d8c09e1b22c66c7064b3c6 (patch)
treeeefbf1b83e81c7fb450d78f733de98ab03abffa3 /src/Wallabag/ApiBundle/Controller
parentd1f260e2d7bc62960267dbe70a1d8dd64f8dd9a7 (diff)
downloadwallabag-f5ea67e4cf8e415530d8c09e1b22c66c7064b3c6.tar.gz
wallabag-f5ea67e4cf8e415530d8c09e1b22c66c7064b3c6.tar.zst
wallabag-f5ea67e4cf8e415530d8c09e1b22c66c7064b3c6.zip
api: copy entry object before sending, to keep id
Workaround for https://github.com/wallabag/android-app/issues/646 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller')
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php5
1 files changed, 4 insertions, 1 deletions
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
575 $this->validateAuthentication(); 575 $this->validateAuthentication();
576 $this->validateUserAccess($entry->getUser()->getId()); 576 $this->validateUserAccess($entry->getUser()->getId());
577 577
578 // We copy $entry to keep id in returned object
579 $e = $entry;
580
578 $em = $this->getDoctrine()->getManager(); 581 $em = $this->getDoctrine()->getManager();
579 $em->remove($entry); 582 $em->remove($entry);
580 $em->flush(); 583 $em->flush();
@@ -582,7 +585,7 @@ class EntryRestController extends WallabagRestController
582 // entry deleted, dispatch event about it! 585 // entry deleted, dispatch event about it!
583 $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); 586 $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
584 587
585 return $this->sendResponse($entry); 588 return $this->sendResponse($e);
586 } 589 }
587 590
588 /** 591 /**