diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/WallabagRestController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/WallabagRestController.php | 17 |
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; | |||
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\HttpFoundation\Response; |
9 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||
10 | use Wallabag\CoreBundle\Entity\Entry; | 9 | use Wallabag\CoreBundle\Entity\Entry; |
11 | use Wallabag\CoreBundle\Entity\Tag; | 10 | use Wallabag\CoreBundle\Entity\Tag; |
12 | use Wallabag\CoreBundle\Service\Extractor; | 11 | use 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 | /** |