From aa4d6562c196926a55819326b0fbe504daf2156f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 20 Feb 2015 14:18:01 +0100 Subject: improve hateoas implementation --- src/Wallabag/CoreBundle/Controller/WallabagRestController.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php index d48c7bbb..b9f7efea 100644 --- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php @@ -10,7 +10,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Service\Extractor; -use Hateoas\HateoasBuilder; class WallabagRestController extends Controller { @@ -74,8 +73,7 @@ class WallabagRestController extends Controller throw $this->createNotFoundException(); } - $hateoas = HateoasBuilder::create()->build(); - $json = $hateoas->serialize($entries, 'json'); + $json = $this->get('serializer')->serialize($entries, 'json'); return new Response($json, 200, array('application/json')); } @@ -92,8 +90,7 @@ class WallabagRestController extends Controller */ public function getEntryAction(Entry $entry) { - $hateoas = HateoasBuilder::create()->build(); - $json = $hateoas->serialize($entry, 'json'); + $json = $this->get('serializer')->serialize($entry, 'json'); return new Response($json, 200, array('application/json')); } @@ -124,7 +121,9 @@ class WallabagRestController extends Controller $em->persist($entry); $em->flush(); - return $entry; + $json = $this->get('serializer')->serialize($entry, 'json'); + + return new Response($json, 200, array('application/json')); } /** -- cgit v1.2.3