plugin/blog/Controller/API/PostController.php
public function publishPostAction(Request $request, Blog $blog, Post $post, User $user)
    {
        if ($this->checkPermission('EDIT', $blog->getResourceNode())
            || $this->checkPermission('MODERATE', $blog->getResourceNode())) {
            $this->postManager->switchPublicationState($post);

            return new JsonResponse($this->postSerializer->serialize($post));
        } else {
            throw new AccessDeniedException();
        }
    }
public function publishPostAction(Request $request, Blog $blog, Post $post, User $user)
    {
        if ($this->checkPermission('EDIT', $blog->getResourceNode())
            || $this->checkPermission('MODERATE', $blog->getResourceNode())) {
            $this->postManager->switchPublicationState($post);

            return new JsonResponse($this->postSerializer->serialize($post));
        } else {
            throw new AccessDeniedException();
        }
    }
public function publishPostAction ( Request $ request , Blog $ blog , Post $ post , User $ user ) { if ( $ this -> checkPermission ( 'EDIT' , $ blog -> getResourceNode ( ) ) || $ this -> checkPermission ( 'MODERATE' , $ blog -> getResourceNode ( ) ) ) { $ this -> postManager -> switchPublicationState ( $ post ) ; return new JsonResponse ( $ this -> postSerializer -> serialize ( $ post ) ) ; } else { throw new AccessDeniedException ( ) ; } }
Switch post publication state.

@EXT\Route("/publish/{postId}", name="apiv2_blog_post_publish")
@EXT\Method("PUT")
@EXT\ParamConverter("post", class="IcapBlogBundle:Post", options={"mapping": {"postId": "uuid"}})
@EXT\ParamConverter("user", converter="current_user", options={"allowAnonymous"=false})

@param Blog $blog
@param Post $post
@param User $user

@return array
Switch post publication state .