plugin/blog/Controller/API/PostController.php
public function createPostAction(Request $request, Blog $blog, User $user)
    {
        if ($this->checkPermission('EDIT', $blog->getResourceNode())
            || $this->checkPermission('POST', $blog->getResourceNode())) {
            $data = json_decode($request->getContent(), true);
            $post = $this->postManager->createPost($blog, $this->postSerializer->deserialize($data), $user);
        } else {
            throw new AccessDeniedException();
        }

        return new JsonResponse($this->postSerializer->serialize($post));
    }
public function createPostAction(Request $request, Blog $blog, User $user)
    {
        if ($this->checkPermission('EDIT', $blog->getResourceNode())
            || $this->checkPermission('POST', $blog->getResourceNode())) {
            $data = json_decode($request->getContent(), true);
            $post = $this->postManager->createPost($blog, $this->postSerializer->deserialize($data), $user);
        } else {
            throw new AccessDeniedException();
        }

        return new JsonResponse($this->postSerializer->serialize($post));
    }
public function createPostAction ( Request $ request , Blog $ blog , User $ user ) { if ( $ this -> checkPermission ( 'EDIT' , $ blog -> getResourceNode ( ) ) || $ this -> checkPermission ( 'POST' , $ blog -> getResourceNode ( ) ) ) { $ data = json_decode ( $ request -> getContent ( ) , true ) ; $ post = $ this -> postManager -> createPost ( $ blog , $ this -> postSerializer -> deserialize ( $ data ) , $ user ) ; } else { throw new AccessDeniedException ( ) ; } return new JsonResponse ( $ this -> postSerializer -> serialize ( $ post ) ) ; }
Create blog post.

@EXT\Route("/new", name="apiv2_blog_post_new")
@EXT\Method({"POST", "PUT"})
@EXT\ParamConverter("user", converter="current_user", options={"allowAnonymous"=false})

@param Blog $blog
@param User $user

@return array
Create blog post .