Example #1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     for ($i = 1; $i <= 25; $i++) {
         $product = new Product();
         $product->setTitle('Produit' . $i);
         $product->setDescription('Description du produit' . $i);
         $product->setPriceHt('5');
         $product->setCategory($this->getReference('cat'));
         $product->setTva($this->getReference('tva'));
         $product->setUser($this->getReference('user'));
         $product->setAvailable(1);
         $product->setCreatedAt(new \DateTime('NOW'));
         $product->setUpdatedAt(new \DateTime('NOW'));
         $manager->persist($product);
     }
     $manager->flush();
 }