public function load(ObjectManager $manager) { $faker = Factory::create(); foreach ($this->countries as $key => $value) { $country = new Country(); static $i = 1; $country->setTitle($value); $country->setInfo($faker->realText($maxNbChars = 3000, $indexSize = 2)); $country->setFlag('/image/flag_of_country/Flag_of_' . $value . '.svg.png'); $this->addReference("country {$i}", $country); $i++; $manager->persist($country); } $manager->flush(); }