public function load(ObjectManager $manager) { foreach (range(1, 100) as $i) { $product = new Product(); $product->setEnabled(rand(1, 1000) % 10 < 7); $product->setName($this->getRandomName()); $product->setPrice($this->getRandomPrice()); $product->setTags($this->getRandomTags()); $product->setEan($this->getRandomEan()); $product->setDescription($this->getRandomDescription()); $this->addReference('product-' . $i, $product); $manager->persist($product); } $manager->flush(); }