/**
* Fetch content and update entry.
- * In case it fails, entry will return to avod loosing the data.
+ * In case it fails, $entry->getContent will return an error message.
*
* @param Entry $entry
* @param string $prefixMessage Should be the translation key: entry_saved or entry_reloaded
- *
- * @return Entry
*/
private function updateEntry(Entry $entry, $prefixMessage = 'entry_saved')
{
- // put default title in case of fetching content failed
- $entry->setTitle('No title found');
-
$message = 'flashes.entry.notice.'.$prefixMessage;
try {
- $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
+ $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
} catch (\Exception $e) {
$this->get('logger')->error('Error while saving an entry', [
'exception' => $e,
}
$this->get('session')->getFlashBag()->add('notice', $message);
-
- return $entry;
}
/**
public function showUnreadAction(Request $request, $page)
{
// load the quickstart if no entry in database
- if ($page == 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUsername($this->getUser()->getId()) == 0) {
+ if ($page == 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUser($this->getUser()->getId()) == 0) {
return $this->redirect($this->generateUrl('quickstart'));
}
$pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false);
- $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')
- ->prepare($pagerAdapter, $page);
+ $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter);
try {
$entries->setCurrentPage($page);