diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index f7398e69..fafa49f1 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -53,22 +53,17 @@ class EntryController extends Controller | |||
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Fetch content and update entry. | 55 | * Fetch content and update entry. |
56 | * In case it fails, entry will return to avod loosing the data. | 56 | * In case it fails, $entry->getContent will return an error message. |
57 | * | 57 | * |
58 | * @param Entry $entry | 58 | * @param Entry $entry |
59 | * @param string $prefixMessage Should be the translation key: entry_saved or entry_reloaded | 59 | * @param string $prefixMessage Should be the translation key: entry_saved or entry_reloaded |
60 | * | ||
61 | * @return Entry | ||
62 | */ | 60 | */ |
63 | private function updateEntry(Entry $entry, $prefixMessage = 'entry_saved') | 61 | private function updateEntry(Entry $entry, $prefixMessage = 'entry_saved') |
64 | { | 62 | { |
65 | // put default title in case of fetching content failed | ||
66 | $entry->setTitle('No title found'); | ||
67 | |||
68 | $message = 'flashes.entry.notice.'.$prefixMessage; | 63 | $message = 'flashes.entry.notice.'.$prefixMessage; |
69 | 64 | ||
70 | try { | 65 | try { |
71 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); | 66 | $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); |
72 | } catch (\Exception $e) { | 67 | } catch (\Exception $e) { |
73 | $this->get('logger')->error('Error while saving an entry', [ | 68 | $this->get('logger')->error('Error while saving an entry', [ |
74 | 'exception' => $e, | 69 | 'exception' => $e, |
@@ -79,8 +74,6 @@ class EntryController extends Controller | |||
79 | } | 74 | } |
80 | 75 | ||
81 | $this->get('session')->getFlashBag()->add('notice', $message); | 76 | $this->get('session')->getFlashBag()->add('notice', $message); |
82 | |||
83 | return $entry; | ||
84 | } | 77 | } |
85 | 78 | ||
86 | /** | 79 | /** |
@@ -227,7 +220,7 @@ class EntryController extends Controller | |||
227 | public function showUnreadAction(Request $request, $page) | 220 | public function showUnreadAction(Request $request, $page) |
228 | { | 221 | { |
229 | // load the quickstart if no entry in database | 222 | // load the quickstart if no entry in database |
230 | if ($page == 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUsername($this->getUser()->getId()) == 0) { | 223 | if ($page == 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId()) == 0) { |
231 | return $this->redirect($this->generateUrl('quickstart')); | 224 | return $this->redirect($this->generateUrl('quickstart')); |
232 | } | 225 | } |
233 | 226 | ||
@@ -321,8 +314,7 @@ class EntryController extends Controller | |||
321 | 314 | ||
322 | $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); | 315 | $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); |
323 | 316 | ||
324 | $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries') | 317 | $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter); |
325 | ->prepare($pagerAdapter, $page); | ||
326 | 318 | ||
327 | try { | 319 | try { |
328 | $entries->setCurrentPage($page); | 320 | $entries->setCurrentPage($page); |