aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Controller/TagRestController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller/TagRestController.php')
-rw-r--r--src/Wallabag/ApiBundle/Controller/TagRestController.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/TagRestController.php b/src/Wallabag/ApiBundle/Controller/TagRestController.php
index bc6d4e64..9d333fe4 100644
--- a/src/Wallabag/ApiBundle/Controller/TagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/TagRestController.php
@@ -3,8 +3,8 @@
3namespace Wallabag\ApiBundle\Controller; 3namespace Wallabag\ApiBundle\Controller;
4 4
5use Nelmio\ApiDocBundle\Annotation\ApiDoc; 5use Nelmio\ApiDocBundle\Annotation\ApiDoc;
6use Symfony\Component\HttpFoundation\Request;
7use Symfony\Component\HttpFoundation\JsonResponse; 6use Symfony\Component\HttpFoundation\JsonResponse;
7use Symfony\Component\HttpFoundation\Request;
8use Wallabag\CoreBundle\Entity\Entry; 8use Wallabag\CoreBundle\Entity\Entry;
9use Wallabag\CoreBundle\Entity\Tag; 9use Wallabag\CoreBundle\Entity\Tag;
10 10
@@ -25,13 +25,13 @@ class TagRestController extends WallabagRestController
25 ->getRepository('WallabagCoreBundle:Tag') 25 ->getRepository('WallabagCoreBundle:Tag')
26 ->findAllTags($this->getUser()->getId()); 26 ->findAllTags($this->getUser()->getId());
27 27
28 $json = $this->get('serializer')->serialize($tags, 'json'); 28 $json = $this->get('jms_serializer')->serialize($tags, 'json');
29 29
30 return (new JsonResponse())->setJson($json); 30 return (new JsonResponse())->setJson($json);
31 } 31 }
32 32
33 /** 33 /**
34 * Permanently remove one tag from **every** entry. 34 * Permanently remove one tag from **every** entry by passing the Tag label.
35 * 35 *
36 * @ApiDoc( 36 * @ApiDoc(
37 * requirements={ 37 * requirements={
@@ -44,7 +44,7 @@ class TagRestController extends WallabagRestController
44 public function deleteTagLabelAction(Request $request) 44 public function deleteTagLabelAction(Request $request)
45 { 45 {
46 $this->validateAuthentication(); 46 $this->validateAuthentication();
47 $label = $request->request->get('tag', ''); 47 $label = $request->get('tag', '');
48 48
49 $tag = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findOneByLabel($label); 49 $tag = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findOneByLabel($label);
50 50
@@ -58,7 +58,7 @@ class TagRestController extends WallabagRestController
58 58
59 $this->cleanOrphanTag($tag); 59 $this->cleanOrphanTag($tag);
60 60
61 $json = $this->get('serializer')->serialize($tag, 'json'); 61 $json = $this->get('jms_serializer')->serialize($tag, 'json');
62 62
63 return (new JsonResponse())->setJson($json); 63 return (new JsonResponse())->setJson($json);
64 } 64 }
@@ -78,7 +78,7 @@ class TagRestController extends WallabagRestController
78 { 78 {
79 $this->validateAuthentication(); 79 $this->validateAuthentication();
80 80
81 $tagsLabels = $request->request->get('tags', ''); 81 $tagsLabels = $request->get('tags', '');
82 82
83 $tags = []; 83 $tags = [];
84 84
@@ -100,13 +100,13 @@ class TagRestController extends WallabagRestController
100 100
101 $this->cleanOrphanTag($tags); 101 $this->cleanOrphanTag($tags);
102 102
103 $json = $this->get('serializer')->serialize($tags, 'json'); 103 $json = $this->get('jms_serializer')->serialize($tags, 'json');
104 104
105 return (new JsonResponse())->setJson($json); 105 return (new JsonResponse())->setJson($json);
106 } 106 }
107 107
108 /** 108 /**
109 * Permanently remove one tag from **every** entry. 109 * Permanently remove one tag from **every** entry by passing the Tag ID.
110 * 110 *
111 * @ApiDoc( 111 * @ApiDoc(
112 * requirements={ 112 * requirements={
@@ -126,7 +126,7 @@ class TagRestController extends WallabagRestController
126 126
127 $this->cleanOrphanTag($tag); 127 $this->cleanOrphanTag($tag);
128 128
129 $json = $this->get('serializer')->serialize($tag, 'json'); 129 $json = $this->get('jms_serializer')->serialize($tag, 'json');
130 130
131 return (new JsonResponse())->setJson($json); 131 return (new JsonResponse())->setJson($json);
132 } 132 }
@@ -145,7 +145,7 @@ class TagRestController extends WallabagRestController
145 $em = $this->getDoctrine()->getManager(); 145 $em = $this->getDoctrine()->getManager();
146 146
147 foreach ($tags as $tag) { 147 foreach ($tags as $tag) {
148 if (count($tag->getEntries()) === 0) { 148 if (0 === count($tag->getEntries())) {
149 $em->remove($tag); 149 $em->remove($tag);
150 } 150 }
151 } 151 }