Merge pull request #4316 from wallabag/fix-remove-pictures-api

Fixed bug when we delete entry via API
This commit is contained in:
Kevin Decherf 2020-04-06 17:59:58 +02:00 committed by GitHub
commit a0cb41c509
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -239,12 +239,12 @@ class EntryRestController extends WallabagRestController
$results[$key]['url'] = $url;
if (false !== $entry) {
// entry deleted, dispatch event about it!
$this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
$em = $this->getDoctrine()->getManager();
$em->remove($entry);
$em->flush();
// entry deleted, dispatch event about it!
$this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
}
$results[$key]['entry'] = $entry instanceof Entry ? true : false;
@ -610,13 +610,13 @@ class EntryRestController extends WallabagRestController
$response = $this->sendResponse($e);
}
// entry deleted, dispatch event about it!
$this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
$em = $this->getDoctrine()->getManager();
$em->remove($entry);
$em->flush();
// entry deleted, dispatch event about it!
$this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
return $response;
}