Newscoop\ArticlesBundle\Entity\EditorialComment::setParent PHP Метод

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

Sets the value of parent.
public setParent ( EditorialComment $parent ) : self
$parent EditorialComment the parent
Результат self
    public function setParent(EditorialComment $parent)
    {
        $this->parent = $parent;
        return $this;
    }

Usage Example

 /**
  * Create new editorial comment for Article
  *
  * @param string                   $commentContent
  * @param Article                  $article
  * @param User                     $user
  * @param EditorialComment\null    $parrentComment
  */
 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;
 }