aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-02-20 14:18:01 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-03-06 20:50:30 +0100
commitaa4d6562c196926a55819326b0fbe504daf2156f (patch)
tree03fcc7536a051ce11a4349589572aae29b6b4202
parent0ed6302212eec00e188c61acbd92bde80406f4ba (diff)
downloadwallabag-aa4d6562c196926a55819326b0fbe504daf2156f.tar.gz
wallabag-aa4d6562c196926a55819326b0fbe504daf2156f.tar.zst
wallabag-aa4d6562c196926a55819326b0fbe504daf2156f.zip
improve hateoas implementation
-rw-r--r--src/Wallabag/CoreBundle/Controller/WallabagRestController.php11
1 files 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;
10use Wallabag\CoreBundle\Entity\Entry; 10use Wallabag\CoreBundle\Entity\Entry;
11use Wallabag\CoreBundle\Entity\Tag; 11use Wallabag\CoreBundle\Entity\Tag;
12use Wallabag\CoreBundle\Service\Extractor; 12use Wallabag\CoreBundle\Service\Extractor;
13use Hateoas\HateoasBuilder;
14 13
15class WallabagRestController extends Controller 14class WallabagRestController extends Controller
16{ 15{
@@ -74,8 +73,7 @@ class WallabagRestController extends Controller
74 throw $this->createNotFoundException(); 73 throw $this->createNotFoundException();
75 } 74 }
76 75
77 $hateoas = HateoasBuilder::create()->build(); 76 $json = $this->get('serializer')->serialize($entries, 'json');
78 $json = $hateoas->serialize($entries, 'json');
79 77
80 return new Response($json, 200, array('application/json')); 78 return new Response($json, 200, array('application/json'));
81 } 79 }
@@ -92,8 +90,7 @@ class WallabagRestController extends Controller
92 */ 90 */
93 public function getEntryAction(Entry $entry) 91 public function getEntryAction(Entry $entry)
94 { 92 {
95 $hateoas = HateoasBuilder::create()->build(); 93 $json = $this->get('serializer')->serialize($entry, 'json');
96 $json = $hateoas->serialize($entry, 'json');
97 94
98 return new Response($json, 200, array('application/json')); 95 return new Response($json, 200, array('application/json'));
99 } 96 }
@@ -124,7 +121,9 @@ class WallabagRestController extends Controller
124 $em->persist($entry); 121 $em->persist($entry);
125 $em->flush(); 122 $em->flush();
126 123
127 return $entry; 124 $json = $this->get('serializer')->serialize($entry, 'json');
125
126 return new Response($json, 200, array('application/json'));
128 } 127 }
129 128
130 /** 129 /**