コード例 #1
0
 /**
  * @param SchoolYear $object
  */
 private function manageFileUpload($object)
 {
     $object->setUploadAbsolutePath($this->absoluteUploadPath);
     if ($object->getFile()) {
         $object->refreshUpdated();
     }
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     // record all school years
     $entity = new SchoolYear();
     $entity->setDateStart(new \DateTime('2015-09-01'));
     $entity->setDateEnd(new \DateTime('2016-07-05'));
     $entity->setFilenameIcalendar('Calendrier_Scolaire_Zone_B.ics');
     $manager->persist($entity);
     $this->setReference('2015-2016', $entity);
     $entity = new SchoolYear();
     $entity->setDateStart(new \DateTime('2016-09-01'));
     $entity->setDateEnd(new \DateTime('2017-07-07'));
     $entity->setFilenameIcalendar('Calendrier_Scolaire_Zone_B.ics');
     $manager->persist($entity);
     $this->setReference('2016-2017', $entity);
     $entity = new SchoolYear();
     $entity->setDateStart(new \DateTime('2017-09-04'));
     $entity->setDateEnd(new \DateTime('2018-07-06'));
     $entity->setFilenameIcalendar('Calendrier_Scolaire_Zone_B.ics');
     $manager->persist($entity);
     $this->setReference('2017-2018', $entity);
     $manager->flush();
     $path = __DIR__ . '/../Files/';
     // record all holidays
     $this->getReference('2015-2016')->setUploadAbsolutePath($path);
     $manager->getRepository('WCSCantineBundle:SchoolHoliday')->updateAllFrom($this->getReference('2015-2016'));
     $this->getReference('2016-2017')->setUploadAbsolutePath($path);
     $manager->getRepository('WCSCantineBundle:SchoolHoliday')->updateAllFrom($this->getReference('2016-2017'));
     $this->getReference('2017-2018')->setUploadAbsolutePath($path);
     $manager->getRepository('WCSCantineBundle:SchoolHoliday')->updateAllFrom($this->getReference('2017-2018'));
 }
コード例 #3
0
 /**
  * @param SchoolYear $schoolYear
  */
 private function addEventWithin(Period $event, SchoolYear $schoolYear)
 {
     if ($event->getFirstDate() > $schoolYear->getDateStart() && $event->getLastDate() < $schoolYear->getDateEnd()) {
         $holiday = new SchoolHoliday();
         $holiday->setDateStart($event->getFirstDate());
         $holiday->setDateEnd($event->getLastDate());
         $holiday->setDescription($event->getDescription());
         $holiday->setSchoolYear($schoolYear);
         $schoolYear->addSchoolHoliday($holiday);
         $this->getEntityManager()->persist($holiday);
     }
 }