diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-02-20 11:45:38 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-03-06 20:50:29 +0100 |
commit | 0f00688096645606c7806a619ca27e6f30ce820c (patch) | |
tree | e4d37db4fa55de871d31625c1c508f899cc8a474 /src/Wallabag/CoreBundle/Controller | |
parent | 73b774438395d0ed74d0fd863194d2ebfb68d9ce (diff) | |
download | wallabag-0f00688096645606c7806a619ca27e6f30ce820c.tar.gz wallabag-0f00688096645606c7806a619ca27e6f30ce820c.tar.zst wallabag-0f00688096645606c7806a619ca27e6f30ce820c.zip |
first draft of hypermedia implementation
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/WallabagRestController.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php index e9cd8c93..cadd7e75 100644 --- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php | |||
@@ -5,10 +5,12 @@ namespace Wallabag\CoreBundle\Controller; | |||
5 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; | 5 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
7 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
8 | use Symfony\Component\HttpFoundation\Response; | ||
8 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | 9 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
9 | use Wallabag\CoreBundle\Entity\Entry; | 10 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use Wallabag\CoreBundle\Entity\Tag; | 11 | use Wallabag\CoreBundle\Entity\Tag; |
11 | use Wallabag\CoreBundle\Service\Extractor; | 12 | use Wallabag\CoreBundle\Service\Extractor; |
13 | use Hateoas\HateoasBuilder; | ||
12 | 14 | ||
13 | class WallabagRestController extends Controller | 15 | class WallabagRestController extends Controller |
14 | { | 16 | { |
@@ -72,6 +74,9 @@ class WallabagRestController extends Controller | |||
72 | throw $this->createNotFoundException(); | 74 | throw $this->createNotFoundException(); |
73 | } | 75 | } |
74 | 76 | ||
77 | $hateoas = HateoasBuilder::create()->build(); | ||
78 | $json = $hateoas->serialize($entries, 'json'); | ||
79 | |||
75 | return $entries; | 80 | return $entries; |
76 | } | 81 | } |
77 | 82 | ||
@@ -87,7 +92,10 @@ class WallabagRestController extends Controller | |||
87 | */ | 92 | */ |
88 | public function getEntryAction(Entry $entry) | 93 | public function getEntryAction(Entry $entry) |
89 | { | 94 | { |
90 | return $entry; | 95 | $hateoas = HateoasBuilder::create()->build(); |
96 | $json = $hateoas->serialize($entry, 'json'); | ||
97 | |||
98 | return new Response($json, 200, array('application/json')); | ||
91 | } | 99 | } |
92 | 100 | ||
93 | /** | 101 | /** |