/** * Add a new comment * * @param Comment $comment * @return Article */ public function addComment(Comment $comment) { $comment->setArticle($this); $this->comments->add($comment); return $this; }
/** * Create a new Comment, persist it * * @param Comment $comment */ public function create(Comment $comment) { $comment->setCreatedDate(new DateTime()); $this->em->persist($comment); }