- /**
- * Global method to retrieve random entries depending on the given type.
- *
- * @param string $type Entries type: unread, starred, archive or untagged
- *
- * @return \Symfony\Component\HttpFoundation\RedirectResponse
- */
- private function showRandomEntries($type)
- {
- $repository = $this->get('wallabag_core.entry_repository');
-
- try {
- $entry = $repository->getRandomEntry($this->getUser()->getId(), $type);
- } catch (NoResultException $e) {
- $bag = $this->get('session')->getFlashBag();
- $bag->clear();
- $bag->add('notice', 'flashes.entry.notice.no_random_entry');
-
- return $this->redirect($this->generateUrl('homepage'));
- }
-
- return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()]));
- }
-