private function populate()
 {
     // engines
     $v8 = new Engine();
     $v8->setType('V8');
     $v8->setValves(8);
     $this->em->persist($v8);
     $v6 = new Engine();
     $v6->setType('V6');
     $v6->setValves(8);
     $this->em->persist($v6);
     $this->em->flush();
     // cars
     $audi80 = new Car();
     $audi80->setEngine($v8);
     $audi80->setTitle('Audi-80');
     $this->em->persist($audi80);
     $audi80s = new Car();
     $audi80s->setParent($audi80);
     $audi80s->setTitle('Audi-80s');
     $audi80s->setEngine($v8);
     $this->em->persist($audi80s);
     $icarus = new Bus();
     $icarus->setEngine($v8);
     $icarus->setTitle('Icarus');
     $this->em->persist($icarus);
     $audiJet = new Car();
     $audiJet->setParent($audi80);
     $audiJet->setTitle('Audi-jet');
     $audiJet->setEngine($v6);
     $this->em->persist($audiJet);
     $today = \DateTime::createFromFormat(self::TRAVEL_DATE_FORMAT, self::TODAY);
     $tomorrow = \DateTime::createFromFormat(self::TRAVEL_DATE_FORMAT, self::TOMORROW);
     for ($i = 0; $i < self::SEATS; $i++) {
         $reservationBratislava = new Reservation();
         $reservationBratislava->setBus($icarus);
         $reservationBratislava->setDestination('Bratislava');
         $reservationBratislava->setTravelDate($today);
         $reservationBratislava->setName('Bratislava Today ' . $i);
         $this->em->persist($reservationBratislava);
         $reservationBratislava = new Reservation();
         $reservationBratislava->setBus($icarus);
         $reservationBratislava->setDestination('Bratislava');
         $reservationBratislava->setTravelDate($tomorrow);
         $reservationBratislava->setName('Bratislava Tomorrow ' . $i);
         $this->em->persist($reservationBratislava);
         $reservationPrague = new Reservation();
         $reservationPrague->setBus($icarus);
         $reservationPrague->setDestination('Prague');
         $reservationPrague->setTravelDate($today);
         $reservationPrague->setName('Prague Today ' . $i);
         $this->em->persist($reservationPrague);
     }
     $this->em->flush();
 }
 private function populate()
 {
     // engines
     $v8 = new Engine();
     $v8->setType('V8');
     $v8->setValves(8);
     $this->em->persist($v8);
     $v6 = new Engine();
     $v6->setType('V6');
     $v6->setValves(8);
     $this->em->persist($v6);
     $this->em->flush();
     // cars
     $audi80 = new Car();
     $audi80->setEngine($v8);
     $audi80->setTitle('Audi-80');
     $this->em->persist($audi80);
     $audi80s = new Car();
     $audi80s->setParent($audi80);
     $audi80s->setTitle('Audi-80s');
     $audi80s->setEngine($v8);
     $this->em->persist($audi80s);
     $icarus = new Bus();
     $icarus->setEngine($v8);
     $icarus->setTitle('Icarus');
     $this->em->persist($icarus);
     $audiJet = new Car();
     $audiJet->setParent($audi80);
     $audiJet->setTitle('Audi-jet');
     $audiJet->setEngine($v6);
     $this->em->persist($audiJet);
     $this->em->flush();
 }