Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
14 | public function listAction(Request $request) |
||
15 | { |
||
16 | /** @var VisitQueryBuilder $qb */ |
||
17 | $qb = $this->getQueryBuilder(); |
||
18 | |||
19 | $currentPage = $request->query->get('page', 1); |
||
20 | |||
21 | if ($request->query->has('search')) { |
||
22 | $qb->search($request->query->get('search')); |
||
23 | } |
||
24 | |||
25 | $visits = $qb->sortBy('timestamp')->reverse() |
||
26 | ->limit(30)->fromPage($currentPage) |
||
27 | ->getModels($fast = true); |
||
28 | |||
29 | return array( |
||
30 | "visits" => $visits, |
||
31 | "currentPage" => $currentPage, |
||
32 | "totalPages" => $qb->countPages(), |
||
33 | "search" => $request->query->get('search') |
||
34 | ); |
||
35 | } |
||
36 | |||
41 |