Ejemplo n.º 1
0
 public function postPersist($category)
 {
     if ($category->getDestination()->getId() != 10) {
         return;
     }
     $manager = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
     $fechaInicio = strtotime(Date('d') . "-" . Date('m') . "-" . $category->getYear());
     $fechaFin = strtotime("31-12-" . $category->getYear());
     for ($i = $fechaInicio; $i <= $fechaFin; $i += 86400) {
         $tourDate = new TourDate();
         $tourDate->setDate(new \DateTime(date("d-m-Y", $i)));
         $tourDate->setAvailability(null);
         $tourDate->setCategory($category);
         $manager->persist($tourDate);
     }
     $manager->flush();
 }