diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-05-31 11:31:16 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-05-31 11:31:16 +0200 |
commit | f329e769fd7795f408643735edccb4dc4215c900 (patch) | |
tree | ed8f64c94c65fa2f8a40dffd6457d8bcd926f7dd /src/Wallabag/CoreBundle/Controller/EntryController.php | |
parent | 839475776bdacf7e939984ee8230cb84d34c2289 (diff) | |
parent | 3be047456d6f91d8ef5404c9c7698e0d1f9a057d (diff) | |
download | wallabag-f329e769fd7795f408643735edccb4dc4215c900.tar.gz wallabag-f329e769fd7795f408643735edccb4dc4215c900.tar.zst wallabag-f329e769fd7795f408643735edccb4dc4215c900.zip |
Merge pull request #2122 from wallabag/fix-tags-deletion
Fix the deletion of Tags/Entries relation when delete an entry
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 69dfd4b1..33b5e2ad 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -23,10 +23,16 @@ class EntryController extends Controller | |||
23 | { | 23 | { |
24 | try { | 24 | try { |
25 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); | 25 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); |
26 | |||
26 | $em = $this->getDoctrine()->getManager(); | 27 | $em = $this->getDoctrine()->getManager(); |
27 | $em->persist($entry); | 28 | $em->persist($entry); |
28 | $em->flush(); | 29 | $em->flush(); |
29 | } catch (\Exception $e) { | 30 | } catch (\Exception $e) { |
31 | $this->get('logger')->error('Error while saving an entry', [ | ||
32 | 'exception' => $e, | ||
33 | 'entry' => $entry, | ||
34 | ]); | ||
35 | |||
30 | return false; | 36 | return false; |
31 | } | 37 | } |
32 | 38 | ||
@@ -60,11 +66,12 @@ class EntryController extends Controller | |||
60 | return $this->redirect($this->generateUrl('view', ['id' => $existingEntry->getId()])); | 66 | return $this->redirect($this->generateUrl('view', ['id' => $existingEntry->getId()])); |
61 | } | 67 | } |
62 | 68 | ||
63 | $this->updateEntry($entry); | 69 | $message = 'flashes.entry.notice.entry_saved'; |
64 | $this->get('session')->getFlashBag()->add( | 70 | if (false === $this->updateEntry($entry)) { |
65 | 'notice', | 71 | $message = 'flashes.entry.notice.entry_saved_failed'; |
66 | 'flashes.entry.notice.entry_saved' | 72 | } |
67 | ); | 73 | |
74 | $this->get('session')->getFlashBag()->add('notice', $message); | ||
68 | 75 | ||
69 | return $this->redirect($this->generateUrl('homepage')); | 76 | return $this->redirect($this->generateUrl('homepage')); |
70 | } | 77 | } |