public function updateCommentAction(Request $request, Blog $blog, Comment $comment, User $user = null)
    {
        $this->checkPermission('OPEN', $blog->getResourceNode(), [], true);
        //original author or admin can edit, anon cant edit
        if ($blog->isCommentsAuthorized() && $this->isLoggedIn($user)) {
            if ($user !== $comment->getAuthor()) {
                $this->checkPermission('EDIT', $blog->getResourceNode(), [], true);
            }
            $data = $this->decodeRequest($request)['comment'];
            $comment = $this->commentManager->updateComment($blog, $comment, $data);

            return new JsonResponse($this->commentSerializer->serialize($comment));
        } else {
            throw new AccessDeniedException();
        }
    }
public function updateCommentAction(Request $request, Blog $blog, Comment $comment, User $user = null)
    {
        $this->checkPermission('OPEN', $blog->getResourceNode(), [], true);
        //original author or admin can edit, anon cant edit
        if ($blog->isCommentsAuthorized() && $this->isLoggedIn($user)) {
            if ($user !== $comment->getAuthor()) {
                $this->checkPermission('EDIT', $blog->getResourceNode(), [], true);
            }
            $data = $this->decodeRequest($request)['comment'];
            $comment = $this->commentManager->updateComment($blog, $comment, $data);

            return new JsonResponse($this->commentSerializer->serialize($comment));
        } else {
            throw new AccessDeniedException();
        }
    }
public function updateCommentAction ( Request $ request , Blog $ blog , Comment $ comment , User $ user = null ) { $ this -> checkPermission ( 'OPEN' , $ blog -> getResourceNode ( ) , [ ] , true ) ; //original author or admin can edit, anon cant edit if ( $ blog -> isCommentsAuthorized ( ) && $ this -> isLoggedIn ( $ user ) ) { if ( $ user !== $ comment -> getAuthor ( ) ) { $ this -> checkPermission ( 'EDIT' , $ blog -> getResourceNode ( ) , [ ] , true ) ; } $ data = $ this -> decodeRequest ( $ request ) [ 'comment' ] ; $ comment = $ this -> commentManager -> updateComment ( $ blog , $ comment , $ data ) ; return new JsonResponse ( $ this -> commentSerializer -> serialize ( $ comment ) ) ; } else { throw new AccessDeniedException ( ) ; } }
Update post comment.

@EXT\Route("/{commentId}/update", name="apiv2_blog_comment_update")
@EXT\Method("PUT")
@EXT\ParamConverter("comment", class="IcapBlogBundle:Comment", options={"mapping": {"commentId": "uuid"}})
@EXT\ParamConverter("user", converter="current_user", options={"allowAnonymous"=true})

@param Blog    $blog
@param Comment $comment
@param User    $user

@return array
Update post comment .