plugin/tag/Controller/TagController.php
public function addObjectsAction($tag, User $user, Request $request)
    {
        $taggedObjects = $this->manager->tagData([$tag], $this->decodeRequest($request), $user);

        return new JsonResponse(
            !empty($taggedObjects) ? $this->serializer->serialize($taggedObjects[0]->getTag()) : null
        );
    }
public function addObjectsAction($tag, User $user, Request $request)
    {
        $taggedObjects = $this->manager->tagData([$tag], $this->decodeRequest($request), $user);

        return new JsonResponse(
            !empty($taggedObjects) ? $this->serializer->serialize($taggedObjects[0]->getTag()) : null
        );
    }
public function addObjectsAction ( $ tag , User $ user , Request $ request ) { $ taggedObjects = $ this -> manager -> tagData ( [ $ tag ] , $ this -> decodeRequest ( $ request ) , $ user ) ; return new JsonResponse ( ! empty ( $ taggedObjects ) ? $ this -> serializer -> serialize ( $ taggedObjects [ 0 ] -> getTag ( ) ) : null ) ; }
Adds a tag to a collection of taggable objects.
NB. If the tag does not exist, it will be created.

@EXT\Route("/{tag}/object", name="apiv2_tag_add_objects")
@EXT\ParamConverter("user", converter="current_user", options={"allowAnonymous"=false})
@EXT\Method("POST")

@param string  $tag
@param User    $user
@param Request $request

@return JsonResponse
Adds a tag to a collection of taggable objects . NB . If the tag does not exist it will be created .