aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-10-02 17:48:16 +0200
committerGitHub <noreply@github.com>2016-10-02 17:48:16 +0200
commitdfbbf0e18ad585e318c2609e46963e4b9fd198ef (patch)
treea415df1d2e51a35e1501a15d27dbcc2fad971e10 /src/Wallabag
parent77557d289bafc088baf806e4744f110dfd959300 (diff)
parentc3f8b428dd50578a6eba5f4673ea1c9edabd2512 (diff)
downloadwallabag-dfbbf0e18ad585e318c2609e46963e4b9fd198ef.tar.gz
wallabag-dfbbf0e18ad585e318c2609e46963e4b9fd198ef.tar.zst
wallabag-dfbbf0e18ad585e318c2609e46963e4b9fd198ef.zip
Merge pull request #2331 from wallabag/api-links
Fix parameters in API _links
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php17
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php2
2 files changed, 16 insertions, 3 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
index 104720a9..791bf80b 100644
--- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
@@ -82,8 +82,8 @@ class WallabagRestController extends FOSRestController
82 $order = $request->query->get('order', 'desc'); 82 $order = $request->query->get('order', 'desc');
83 $page = (int) $request->query->get('page', 1); 83 $page = (int) $request->query->get('page', 1);
84 $perPage = (int) $request->query->get('perPage', 30); 84 $perPage = (int) $request->query->get('perPage', 30);
85 $since = $request->query->get('since', 0);
86 $tags = $request->query->get('tags', ''); 85 $tags = $request->query->get('tags', '');
86 $since = $request->query->get('since', 0);
87 87
88 $pager = $this->getDoctrine() 88 $pager = $this->getDoctrine()
89 ->getRepository('WallabagCoreBundle:Entry') 89 ->getRepository('WallabagCoreBundle:Entry')
@@ -95,7 +95,20 @@ class WallabagRestController extends FOSRestController
95 $pagerfantaFactory = new PagerfantaFactory('page', 'perPage'); 95 $pagerfantaFactory = new PagerfantaFactory('page', 'perPage');
96 $paginatedCollection = $pagerfantaFactory->createRepresentation( 96 $paginatedCollection = $pagerfantaFactory->createRepresentation(
97 $pager, 97 $pager,
98 new Route('api_get_entries', [], UrlGeneratorInterface::ABSOLUTE_URL) 98 new Route(
99 'api_get_entries',
100 [
101 'archive' => $isArchived,
102 'starred' => $isStarred,
103 'sort' => $sort,
104 'order' => $order,
105 'page' => $page,
106 'perPage' => $perPage,
107 'tags' => $tags,
108 'since' => $since,
109 ],
110 UrlGeneratorInterface::ABSOLUTE_URL
111 )
99 ); 112 );
100 113
101 $json = $this->get('serializer')->serialize($paginatedCollection, 'json'); 114 $json = $this->get('serializer')->serialize($paginatedCollection, 'json');
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 1b023e96..75127b7d 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -128,7 +128,7 @@ class EntryRepository extends EntityRepository
128 $qb->andWhere('e.isStarred =:isStarred')->setParameter('isStarred', (bool) $isStarred); 128 $qb->andWhere('e.isStarred =:isStarred')->setParameter('isStarred', (bool) $isStarred);
129 } 129 }
130 130
131 if ($since >= 0) { 131 if ($since > 0) {
132 $qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since))); 132 $qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since)));
133 } 133 }
134 134