Пример #1
0
 /**
  * Dane samochodow
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     /* CAR START */
     $car = new Car();
     $car->setBrand('Audi');
     $car->setModel('Ninja');
     $car->setNumber('KRA5A105');
     $car->setPrice(100);
     $car->setDescription("\n        <dt>Prędkośc maksymalna</dt>\n        <dd>100km/h</dd>\n        <dt>Ilość pasażerów</dt>\n        <dd>5</dd>\n        <dt>Napęd</dt>\n        <dd>na 2 koła</dd>\n        ");
     $car->setCategory("Osobowe");
     copy($car->getFixturesPath() . '1.jpg', $car->getFixturesPath() . '1-copy.jpg');
     $file = new UploadedFile($this->path . '1-copy.jpg', $car->getBrand() . ' ' . $car->getModel(), 'image/jpg', null, null, true);
     $car->setFile($file);
     $manager->persist($car);
     $car = new Car();
     $car->setBrand('Lada');
     $car->setModel('Predator');
     $car->setNumber('KRA101010');
     $car->setPrice(70);
     $car->setDescription("\n        <dt>Prędkośc maksymalna</dt>\n        <dd>10km/h</dd>\n        <dt>Ilość pasażerów</dt>\n        <dd>2</dd>\n        <dt>Napęd</dt>\n        <dd>na 4 kopyta</dd>\n        ");
     $car->setCategory("Terenowe");
     copy($car->getFixturesPath() . '2.jpg', $car->getFixturesPath() . '2-copy.jpg');
     $file = new UploadedFile($this->path . '2-copy.jpg', $car->getBrand() . ' ' . $car->getModel(), 'image/jpeg', null, null, true);
     $car->setFile($file);
     $manager->persist($car);
     $car = new Car();
     $car->setBrand('Opel');
     $car->setModel('Stonoga');
     $car->setNumber('KRA5A107');
     $car->setPrice(150);
     $car->setDescription("\n        <dt>Prędkośc maksymalna</dt>\n        <dd>300km/h</dd>\n        <dt>Ilość pasażerów</dt>\n        <dd>5</dd>\n        <dt>Napęd</dt>\n        <dd>na 8 kół</dd>\n        ");
     $car->setCategory("Osobowe");
     copy($car->getFixturesPath() . '3.jpg', $car->getFixturesPath() . '3-copy.jpg');
     $file = new UploadedFile($this->path . '3-copy.jpg', $car->getBrand() . ' ' . $car->getModel(), 'image/jpeg', null, null, true);
     $car->setFile($file);
     $manager->persist($car);
     $car = new Car();
     $car->setBrand('Subaru');
     $car->setModel('Impreza');
     $car->setNumber('KRA5A100');
     $car->setPrice(30);
     $car->setDescription("\n        <dt>Prędkośc maksymalna</dt>\n        <dd>25km/h</dd>\n        <dt>Ilość pasażerów</dt>\n        <dd>5</dd>\n        <dt>Napęd</dt>\n        <dd>na 2 koła</dd>\n        ");
     $car->setCategory("Osobowe");
     copy($car->getFixturesPath() . '4.jpg', $car->getFixturesPath() . '4-copy.jpg');
     $file = new UploadedFile($this->path . '4-copy.jpg', $car->getBrand() . ' ' . $car->getModel(), 'image/jpeg', null, null, true);
     $car->setFile($file);
     $manager->persist($car);
     $car = new Car();
     $car->setBrand('Rolls-Royce');
     $car->setModel('DeLuxe');
     $car->setNumber('KRA5A005');
     $car->setPrice(1000);
     $car->setDescription("\n        <dt>Prędkośc maksymalna</dt>\n        <dd>105km/h</dd>\n        <dt>Ilość pasażerów</dt>\n        <dd>10</dd>\n        <dt>Napęd</dt>\n        <dd>na 4 koła</dd>\n        ");
     $car->setCategory("Terenowe");
     copy($car->getFixturesPath() . '5.jpg', $car->getFixturesPath() . '5-copy.jpg');
     $file = new UploadedFile($this->path . '5-copy.jpg', $car->getBrand() . ' ' . $car->getModel(), 'image/jpeg', null, null, true);
     $car->setFile($file);
     $manager->persist($car);
     /* CAR END */
     $manager->flush();
 }