From eaf95758dc3ebc0e666a8317cd37311f03cd2233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 10 Feb 2015 06:44:38 +0100 Subject: [PATCH 1/4] GET /api/entries returns object, no more array --- src/Wallabag/CoreBundle/Controller/WallabagRestController.php | 2 +- src/Wallabag/CoreBundle/Repository/EntryRepository.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php index c298d8495..ab2c1181c 100644 --- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php @@ -45,7 +45,7 @@ class WallabagRestController extends Controller ->getRepository('WallabagCoreBundle:Entry') ->findEntries(1, $isArchived, $isStarred, $isDeleted, $sort, $order); - if (!is_array($entries)) { + if (is_null($entries)) { throw $this->createNotFoundException(); } diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 5ae1337a8..a33d698d8 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -126,6 +126,6 @@ class EntryRepository extends EntityRepository return $qb ->getQuery() - ->getResult(Query::HYDRATE_ARRAY); + ->getResult(); } } From 11204db45a378e6679abff2f75e6533e780d1a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 10 Feb 2015 12:14:09 +0100 Subject: [PATCH 2/4] change phpdoc --- src/Wallabag/CoreBundle/Repository/EntryRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index a33d698d8..836a2edd8 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -98,7 +98,7 @@ class EntryRepository extends EntityRepository * @param string $sort * @param string $order * - * @return ArrayCollection + * @return Entry */ public function findEntries($userId, $isArchived = null, $isStarred = null, $isDeleted = null, $sort = 'created', $order = 'ASC') { From 3d3368cfd5e8dbe320428f479a49cabfddc58acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 10 Feb 2015 13:47:57 +0100 Subject: [PATCH 3/4] change test if we have no entry in GET /api/entries --- src/Wallabag/CoreBundle/Controller/WallabagRestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php index ab2c1181c..4784cb012 100644 --- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php @@ -45,7 +45,7 @@ class WallabagRestController extends Controller ->getRepository('WallabagCoreBundle:Entry') ->findEntries(1, $isArchived, $isStarred, $isDeleted, $sort, $order); - if (is_null($entries)) { + if (!($entries)) { throw $this->createNotFoundException(); } From 017e20895f6d731b2b8fd7cee0cd954eb7e96145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 10 Feb 2015 13:53:00 +0100 Subject: [PATCH 4/4] findEntries returns array --- src/Wallabag/CoreBundle/Repository/EntryRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 836a2edd8..abf01930d 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -98,7 +98,7 @@ class EntryRepository extends EntityRepository * @param string $sort * @param string $order * - * @return Entry + * @return array */ public function findEntries($userId, $isArchived = null, $isStarred = null, $isDeleted = null, $sort = 'created', $order = 'ASC') {