aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php33
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php14
2 files changed, 19 insertions, 28 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 4070a603..c4975ae6 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -113,34 +113,7 @@ class EntryController extends Controller
113 */ 113 */
114 public function showAllAction(Request $request, $page) 114 public function showAllAction(Request $request, $page)
115 { 115 {
116 $form = $this->get('form.factory')->create(new EntryFilterType()); 116 return $this->showEntries('all', $request, $page);
117
118 $filterBuilder = $this->getDoctrine()
119 ->getRepository('WallabagCoreBundle:Entry')
120 ->findAllByUser($this->getUser()->getId());
121
122 if ($request->query->has($form->getName())) {
123 // manually bind values from the request
124 $form->submit($request->query->get($form->getName()));
125
126 // build the query from the given form object
127 $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder);
128 }
129
130 $pagerAdapter = new DoctrineORMAdapter($filterBuilder->getQuery());
131 $entries = new Pagerfanta($pagerAdapter);
132
133 $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage());
134 $entries->setCurrentPage($page);
135
136 return $this->render(
137 'WallabagCoreBundle:Entry:entries.html.twig',
138 array(
139 'form' => $form->createView(),
140 'entries' => $entries,
141 'currentPage' => $page,
142 )
143 );
144 } 117 }
145 118
146 /** 119 /**
@@ -215,6 +188,10 @@ class EntryController extends Controller
215 $qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId()); 188 $qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId());
216 break; 189 break;
217 190
191 case 'all':
192 $qb = $repository->getBuilderForAllByUser($this->getUser()->getId());
193 break;
194
218 default: 195 default:
219 throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); 196 throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
220 } 197 }
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 5538ae82..e764e8f7 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -25,6 +25,20 @@ class EntryRepository extends EntityRepository
25 } 25 }
26 26
27 /** 27 /**
28 * Retrieves all entries for a user.
29 *
30 * @param int $userId
31 *
32 * @return QueryBuilder
33 */
34 public function getBuilderForAllByUser($userId)
35 {
36 return $this
37 ->getBuilderByUser($userId)
38 ;
39 }
40
41 /**
28 * Retrieves unread entries for a user. 42 * Retrieves unread entries for a user.
29 * 43 *
30 * @param int $userId 44 * @param int $userId