private function populate() { $article = new RelatedArticle(); $article->setTitle('a1-t-v1'); $article->setContent('a1-c-v1'); $author = new Author(); $author->setName('John Doe'); $author->setEmail('*****@*****.**'); $comment = new Comment(); $comment->setArticle($article); $comment->setAuthor($author); $comment->setMessage('m-v1'); $comment->setSubject('s-v1'); $this->dm->persist($article); $this->dm->persist($comment); $this->dm->flush(); $comment->setMessage('m-v2'); $this->dm->persist($comment); $this->dm->flush(); $comment->setSubject('s-v3'); $this->dm->persist($comment); $this->dm->flush(); $article2 = new RelatedArticle(); $article2->setTitle('a2-t-v1'); $article2->setContent('a2-c-v1'); $author2 = new Author(); $author2->setName('Jane Doe'); $author2->setEmail('*****@*****.**'); $comment->setAuthor($author2); $comment->setArticle($article2); $this->dm->persist($article2); $this->dm->persist($comment); $this->dm->flush(); $comment->setMessage('m-v5'); $this->dm->persist($comment); $this->dm->flush(); $this->dm->clear(); }
private function populate() { $article = new RelatedArticle(); $article->setTitle('a1-t-v1'); $article->setContent('a1-c-v1'); $comment = new Comment(); $comment->setArticle($article); $comment->setMessage('m-v1'); $comment->setSubject('s-v1'); $this->dm->persist($article); $this->dm->persist($comment); $this->dm->flush(); $comment->setMessage('m-v2'); $this->dm->persist($comment); $this->dm->flush(); $comment->setSubject('s-v3'); $this->dm->persist($comment); $this->dm->flush(); $article2 = new RelatedArticle(); $article2->setTitle('a2-t-v1'); $article2->setContent('a2-c-v1'); $comment->setArticle($article2); $this->dm->persist($article2); $this->dm->persist($comment); $this->dm->flush(); $comment->setMessage('m-v5'); $this->dm->persist($comment); $this->dm->flush(); $this->dm->clear(); }