getRepository(MemberCase::class)->findAll(); foreach ($cases as $case) { print "Adding referrals for case {$case->getCaseNumber()}".PHP_EOL; $refCount = $gen->numberBetween(0, $_ENV['CREATE_REFERRALS']); for ($x = 0; $x < $refCount; $x++) { $ref = new Referral(); $ref->setReferralId($gen->numberBetween(1000000, 9999999)) ->setMemberCase($case) ->setServiceCode($gen->randomElement(ReferralServiceType::class)) ->setEndDate($gen->dateTimeBetween('+1 month', '+1 year')) ->setHours($gen->numberBetween(1, 75)) ; print "Adding referral {$ref->getReferralId()}".PHP_EOL; $manager->persist($ref); } } $manager->flush(); } public function getDependencies(): array { return [ MemberCaseFixture::class, ]; } }