X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FWallabagRestController.php;h=cb68784d55d02080d5262ae3bdac5b61d4d8474c;hb=2691cf04384239c546e141af6cc3c22b210dae58;hp=276cfe1c78b18412aaa0577c753c3b3418280c08;hpb=1d14779154481b320e1c44fccf2558d8c9fa43a1;p=github%2Fwallabag%2Fwallabag.git 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; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Service\Extractor; @@ -244,12 +243,24 @@ class WallabagRestController extends Controller * * @ApiDoc( * requirements={ - * {"name"="tag", "dataType"="string", "requirement"="\w+", "description"="The tag"} + * {"name"="label", "dataType"="string", "requirement"="\w+", "description"="Label of the tag"} * } * ) */ - public function getTagAction(Tag $tag) + public function getTagAction($label) { + $tag = $this + ->getDoctrine() + ->getRepository('WallabagCoreBundle:Tag') + ->findOneByLabel($label); + + if (is_null($tag)) { + throw $this->createNotFoundException(); + } + + $json = $this->get('serializer')->serialize($tag, 'json'); + + return new Response($json, 200, array('application/json')); } /**