Ejemplo n.º 1
0
 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('admin');
     $user->setEmail('*****@*****.**');
     $user->setPlainPassword('admin');
     $user->setEnabled(true);
     $guest = new Guest();
     $guest->setLastName('Wawrinka');
     $guest->setFirstName('Stan');
     $guest->setGender('Male');
     $event = new Event();
     $event->setName('Paléo Festival');
     $event->setDate(new \DateTime("2015-12-26"));
     $event->setPlace('Nyon');
     $event->setCapacity(230000);
     $event->addGuest($guest);
     $manager->persist($user);
     $manager->persist($guest);
     $manager->persist($event);
     $manager->flush();
 }
Ejemplo n.º 2
0
 /**
  * @param Event $event
  * @throws EventFrequencyEmptyException
  */
 private function initNextRun(Event $event)
 {
     if (!$event->getFrequency()) {
         throw new EventFrequencyEmptyException();
     }
     date_default_timezone_set($this->container->getParameter("app_core_timezone"));
     $cron = CronExpression::factory($event->getFrequency());
     $cron->isDue();
     $event->setNextRun($cron->getNextRunDate());
 }