public function generateTeam() { $faker = Factory::create(); $team = new Team(); $arr = 'ABCDEIFG'; $em = $this->getDoctrine()->getManager(); for ($i = 0; $i < 10; $i++) { $team->setGroups(substr($arr, rand(0, strlen($arr) - 1), 1)); $team->setCountry($faker->country); $em->persist($team); } $em->flush(); return; }