private function generateRandomComment() { $comment = new Comment(); $comment->setUser('Mickey Mouse'); $comment->setTheText($this->generateLoremIpsum()); $comment->setDate(new DateTime('2011-02-'.rand(1,31))); return $comment; }
/** * Add comments * * @param Bundle\BlogBundle\Entity\Comment $comments */ public function addComments(\Bundle\BlogBundle\Entity\Comment $comments) { if ($comments->getPost() == null) { $comments->setPost($this); } $this->comments[] = $comments; }