Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 /**
  * 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;
 }