X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FApiBundle%2FController%2FWallabagRestController.php;h=587013f68fbac8999a8f6425e2edcb3e3c2ef7f0;hb=fc73222723c7a0c9b577805d3ef51eb96b124b92;hp=74bfe4dcdb286a3337e00d889a80ffb3d1918b05;hpb=c997cfcc9c161241a6398b0942a1a869688d807a;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 74bfe4dc..587013f6 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -27,7 +27,7 @@ class WallabagRestController extends FOSRestController ->findOneByLabel($label); if (is_null($tagEntity)) { - $tagEntity = new Tag($this->getUser()); + $tagEntity = new Tag(); $tagEntity->setLabel($label); } @@ -74,8 +74,7 @@ class WallabagRestController extends FOSRestController $perPage = (int) $request->query->get('perPage', 30); $tags = $request->query->get('tags', []); - $pager = $this - ->getDoctrine() + $pager = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') ->findEntries($this->getUser()->getId(), $isArchived, $isStarred, $sort, $order); @@ -311,7 +310,12 @@ class WallabagRestController extends FOSRestController public function getTagsAction() { $this->validateAuthentication(); - $json = $this->get('serializer')->serialize($this->getUser()->getTags(), 'json'); + + $tags = $this->getDoctrine() + ->getRepository('WallabagCoreBundle:Tag') + ->findAllTags($this->getUser()->getId()); + + $json = $this->get('serializer')->serialize($tags, 'json'); return $this->renderJsonResponse($json); } @@ -328,7 +332,10 @@ class WallabagRestController extends FOSRestController public function deleteTagAction(Tag $tag) { $this->validateAuthentication(); - $this->validateUserAccess($tag->getUser()->getId()); + + $this->getDoctrine() + ->getRepository('WallabagCoreBundle:Entry') + ->removeTag($this->getUser()->getId(), $tag); $em = $this->getDoctrine()->getManager(); $em->remove($tag);