Example #1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $models = [];
     $brand = $this->getReference('brand-yamaha');
     $category = $this->getReference('category-moto');
     foreach (['YZF-R6', 'YZF-R1'] as $modelName) {
         $model = new Model();
         $model->setName($modelName);
         $model->setBrand($brand);
         $model->addCategory($category);
         $model->setSlug(sprintf('%s/%s', $brand->getSlug(), strtolower($modelName)));
         $manager->persist($model);
         $this->addReference('model-' . $modelName, $model);
     }
     $manager->flush();
 }