Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     //        $hotelSeasons1 = new HotelSeasons();
     //        $hotelSeasons1->setHotel($this->getReference('hotel1'));
     //        $hotelSeasons1->setStart(new \DateTime("2015-01-01 00:00:00"));
     //        $hotelSeasons1->setFinish(new \DateTime("2015-05-31 23:59:59"));
     //        $manager->persist($hotelSeasons1);
     //
     //        $hotelSeasons2 = new HotelSeasons();
     //        $hotelSeasons2->setHotel($this->getReference('hotel1'));
     //        $hotelSeasons2->setStart(new \DateTime("2015-06-01 00:00:00"));
     //        $hotelSeasons2->setFinish(new \DateTime("2015-12-31 23:59:59"));
     //        $manager->persist($hotelSeasons2);
     //
     //        $manager->flush();
     //
     //        $this->addReference('hotelSeasons1', $hotelSeasons1);
     //        $this->addReference('hotelSeasons2', $hotelSeasons2);
     $hotelN = 1;
     for ($i = 1; $i <= 1000; $i++) {
         if ($i % 2 == 0) {
             $hotelSeasons1 = new HotelSeasons();
             $hotelSeasons1->setHotel($this->getReference('hotel' . $hotelN));
             $hotelSeasons1->setStart(new \DateTime("2015-06-01 00:00:00"));
             $hotelSeasons1->setFinish(new \DateTime("2015-12-31 23:59:59"));
             $manager->persist($hotelSeasons1);
             $manager->flush();
             $this->addReference('hotelSeasons' . $i, $hotelSeasons1);
             $hotelN++;
         } else {
             $hotelSeasons1 = new HotelSeasons();
             $hotelSeasons1->setHotel($this->getReference('hotel' . $hotelN));
             $hotelSeasons1->setStart(new \DateTime("2015-01-01 00:00:00"));
             $hotelSeasons1->setFinish(new \DateTime("2015-05-31 23:59:59"));
             $manager->persist($hotelSeasons1);
             $manager->flush();
             $this->addReference('hotelSeasons' . $i, $hotelSeasons1);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Add hotelSeasons
  *
  * @param \Kvartiri\KvartiriBundle\Entity\HotelSeasons $hotelSeasons
  * @return RoomSeasons
  */
 public function addHotelSeason(\Kvartiri\KvartiriBundle\Entity\HotelSeasons $hotelSeasons)
 {
     $this->hotelSeasons[] = $hotelSeasons;
     $hotelSeasons->addRoomSeason($this);
     return $this;
 }