/** * @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); } }
/** * Add Holiday * * @param \WCS\CantineBundle\Entity\SchoolHoliday $holidays * * @return SchoolYear */ public function addSchoolHoliday(SchoolHoliday $holiday) { $holiday->setSchoolYear($this); $this->schoolHolidays[] = $holiday; return $this; }