예제 #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;
 }
예제 #2
0
파일: Post.php 프로젝트: rdbsf/BlogBundle
 /**
  * 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;
 }