aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Controller/EntryRestController.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2017-12-18 12:33:05 +0100
committerGitHub <noreply@github.com>2017-12-18 12:33:05 +0100
commit3ccf086391588b1eb0f6d7bcc420ed529f7fdd8f (patch)
treeeefbf1b83e81c7fb450d78f733de98ab03abffa3 /src/Wallabag/ApiBundle/Controller/EntryRestController.php
parentd1f260e2d7bc62960267dbe70a1d8dd64f8dd9a7 (diff)
parentf5ea67e4cf8e415530d8c09e1b22c66c7064b3c6 (diff)
downloadwallabag-3ccf086391588b1eb0f6d7bcc420ed529f7fdd8f.tar.gz
wallabag-3ccf086391588b1eb0f6d7bcc420ed529f7fdd8f.tar.zst
wallabag-3ccf086391588b1eb0f6d7bcc420ed529f7fdd8f.zip
Merge pull request #3516 from wallabag/delete-id
api: copy entry object before sending, to keep id
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller/EntryRestController.php')
-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 /**