diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-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 | } |