コード例 #1
0
ファイル: LoadCommentData.php プロジェクト: tarnawski/Blog
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $faker = \Faker\Factory::create('pl_PL');
     for ($a = 0; $a < self::SIZE; $a++) {
         $comment = new Comment();
         $comment->setFirstName($faker->firstNameMale);
         $comment->setContent($faker->text);
         $comment->setPost($this->getReference(sprintf('comment-post-%d', rand(0, LoadCommentPostData::MAX_SIZE - 1))));
         $manager->persist($comment);
     }
     $manager->flush();
 }