getRepository(ReferralSource::class)->findAll(); $users = $manager->getRepository(User::class)->findAll(); $gen = \Faker\Factory::create(); for ($x = 0; $x < $_ENV['CREATE_CASES']; $x++) { $case = new MemberCase(); $case->setCaseNumber($gen->numberBetween(1000000, 9999999)) ->setDcsCaseId($gen->numberBetween(1000000, 9999999)) ->setFirstName($gen->firstName()) ->setLastName($gen->lastName()) ->setCounty($gen->randomElement(County::class)) ->setReferralSource($gen->randomElement($sources)) ->setLevel($gen->randomElement(CaseLevel::class)) ->setAdmitDate($gen->dateTimeBetween('-1 year', 'now')) ->setReferralType('DCS') ; $uc = new UserCase(); $uc->setMemberCase($case); $uc->setUser($gen->randomElement($users)); print "Adding member case {$case->getCaseNumber()}".PHP_EOL; $manager->persist($case); $manager->persist($uc); } $manager->flush(); } public function getDependencies(): array { return [ ReferralSourceFixture::class, UserFixture::class, ]; } }