aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-02-20 16:38:24 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-03-06 20:50:30 +0100
commit2691cf04384239c546e141af6cc3c22b210dae58 (patch)
tree0e3f7047e7edb9628139a7f344ea646f660ac14d /src/Wallabag/CoreBundle/Controller
parent1d14779154481b320e1c44fccf2558d8c9fa43a1 (diff)
downloadwallabag-2691cf04384239c546e141af6cc3c22b210dae58.tar.gz
wallabag-2691cf04384239c546e141af6cc3c22b210dae58.tar.zst
wallabag-2691cf04384239c546e141af6cc3c22b210dae58.zip
GET /api/tags/id_tag method
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r--src/Wallabag/CoreBundle/Controller/WallabagRestController.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
index 276cfe1c..cb68784d 100644
--- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
@@ -6,7 +6,6 @@ use Nelmio\ApiDocBundle\Annotation\ApiDoc;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller; 6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request; 7use Symfony\Component\HttpFoundation\Request;
8use Symfony\Component\HttpFoundation\Response; 8use Symfony\Component\HttpFoundation\Response;
9use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
10use Wallabag\CoreBundle\Entity\Entry; 9use Wallabag\CoreBundle\Entity\Entry;
11use Wallabag\CoreBundle\Entity\Tag; 10use Wallabag\CoreBundle\Entity\Tag;
12use Wallabag\CoreBundle\Service\Extractor; 11use Wallabag\CoreBundle\Service\Extractor;
@@ -244,12 +243,24 @@ class WallabagRestController extends Controller
244 * 243 *
245 * @ApiDoc( 244 * @ApiDoc(
246 * requirements={ 245 * requirements={
247 * {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"} 246 * {"name"="label", "dataType"="string", "requirement"="\w+", "description"="Label of the tag"}
248 * } 247 * }
249 * ) 248 * )
250 */ 249 */
251 public function getTagAction(Tag $tag) 250 public function getTagAction($label)
252 { 251 {
252 $tag = $this
253 ->getDoctrine()
254 ->getRepository('WallabagCoreBundle:Tag')
255 ->findOneByLabel($label);
256
257 if (is_null($tag)) {
258 throw $this->createNotFoundException();
259 }
260
261 $json = $this->get('serializer')->serialize($tag, 'json');
262
263 return new Response($json, 200, array('application/json'));
253 } 264 }
254 265
255 /** 266 /**