X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FEntryController.php;h=fafa49f1b0bb69a156db8318a6ab3e9a9c2bba02;hb=873f6b8e03079d11fab541aa5b0bc6f8fe2d645e;hp=b03f49eda339efe7af80441d9a46b0710e99a056;hpb=be8033bf12b8545183870325755df0a2ffc80f8b;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index b03f49ed..fafa49f1 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -53,22 +53,17 @@ class EntryController extends Controller /** * 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, @@ -79,8 +74,6 @@ class EntryController extends Controller } $this->get('session')->getFlashBag()->add('notice', $message); - - return $entry; } /** @@ -227,7 +220,7 @@ class EntryController extends Controller 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')); } @@ -321,8 +314,7 @@ class EntryController extends Controller $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); @@ -539,8 +531,8 @@ class EntryController extends Controller { $this->checkUserAction($entry); - if (null === $entry->getUuid()) { - $entry->generateUuid(); + if (null === $entry->getUid()) { + $entry->generateUid(); $em = $this->getDoctrine()->getManager(); $em->persist($entry); @@ -548,7 +540,7 @@ class EntryController extends Controller } return $this->redirect($this->generateUrl('share_entry', [ - 'uuid' => $entry->getUuid(), + 'uid' => $entry->getUid(), ])); } @@ -565,7 +557,7 @@ class EntryController extends Controller { $this->checkUserAction($entry); - $entry->cleanUuid(); + $entry->cleanUid(); $em = $this->getDoctrine()->getManager(); $em->persist($entry); @@ -581,7 +573,7 @@ class EntryController extends Controller * * @param Entry $entry * - * @Route("/share/{uuid}", requirements={"uuid" = ".+"}, name="share_entry") + * @Route("/share/{uid}", requirements={"uid" = ".+"}, name="share_entry") * @Cache(maxage="25200", smaxage="25200", public=true) * * @return \Symfony\Component\HttpFoundation\Response