diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index 1a49aee0c..0ec79fd68 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -163,53 +163,6 @@ class CalendarController extends AbstractController ]); } - #[Route(path: '/{_locale}/calendar/calendar/{id}/cancel', name: 'chill_calendar_calendar_cancel')] - - public function cancelAction(Calendar $calendar, Request $request): Response - { - // Deal with sms being sent or not - // Communicate cancellation with the remote calendar. - - $this->denyAccessUnlessGranted(CalendarVoter::EDIT, $calendar); - - [$person, $accompanyingPeriod] = [$calendar->getPerson(), $calendar->getAccompanyingPeriod()]; - - $form = $this->createForm(CancelType::class, $calendar); - $form->add('submit', SubmitType::class); - - if ($accompanyingPeriod instanceof AccompanyingPeriod) { - $view = '@ChillCalendar/Calendar/cancelCalendarByAccompanyingCourse.html.twig'; - $redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_period', ['id' => $accompanyingPeriod->getId()]); - } elseif ($person instanceof Person) { - $view = '@ChillCalendar/Calendar/cancelCalendarByPerson.html.twig'; - $redirectRoute = $this->generateUrl('chill_calendar_calendar_list_by_person', ['id' => $person->getId()]); - } else { - throw new \RuntimeException('nor person or accompanying period'); - } - - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - - $calendar->setStatus($calendar::STATUS_CANCELED); - if ($calendar->getSendSMS()) { - $calendar->setSmsStatus($calendar::SMS_CANCEL_PENDING); - } - $this->em->flush(); - - $this->addFlash('success', $this->translator->trans('chill_calendar.calendar_canceled')); - - return new RedirectResponse($redirectRoute); - } - - return $this->render($view, [ - 'calendar' => $calendar, - 'form' => $form->createView(), - 'accompanyingCourse' => $accompanyingPeriod, - 'person' => $person, - ]); - } - /** * Edit a calendar item. */