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

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

Create new editorial comment for Article
public create ( string $commentContent, Article $article, User $user, Newscoop\ArticlesBundle\Entity\EditorialComment\null $parrentComment = null )
$commentContent string
$article Newscoop\Entity\Article
$user Newscoop\Entity\User
$parrentComment Newscoop\ArticlesBundle\Entity\EditorialComment\null
    public function create($commentContent, Article $article, User $user, $parrentComment = null)
    {
        $editorialComment = new EditorialComment();
        $editorialComment->setComment($commentContent);
        $editorialComment->setUser($user);
        $editorialComment->setArticle($article);
        if ($parrentComment) {
            $editorialComment->setParent($parrentComment);
        }
        $this->em->persist($editorialComment);
        $this->em->flush();
        return $editorialComment;
    }