Newscoop\ArticlesBundle\Services\EditorialCommentsService::edit PHP Метод

edit() публичный Метод

Edit existing editorial comment message
public edit ( string $commentContent, EditorialComment $comment, User $user )
$commentContent string
$comment Newscoop\ArticlesBundle\Entity\EditorialComment
$user Newscoop\Entity\User
    public function edit($commentContent, EditorialComment $comment, User $user)
    {
        if ($comment->getUser()->getId() == $user->getId() || $user->isAdmin()) {
            $comment->setComment($commentContent);
        } else {
            throw new AccessDeniedHttpException("User is not allowed to edit someone else comment");
        }
        $this->em->flush();
        return true;
    }