PersonFixtures.php 494 B

12345678910111213141516171819202122
  1. <?php
  2. namespace App\Tests\Fixture;
  3. use App\Tests\Fixture\Factory\Person\PersonFactory;
  4. use Doctrine\Bundle\FixturesBundle\Fixture;
  5. use Doctrine\Persistence\ObjectManager;
  6. use Zenstruck\Foundry\Factory;
  7. class PersonFixtures extends Fixture
  8. {
  9. public function load(ObjectManager $em): void
  10. {
  11. PersonFactory::createMany(10, static function () {
  12. return [
  13. 'username' => Factory::faker()->name(),
  14. ];
  15. });
  16. $em->flush();
  17. }
  18. }