diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index 22696dc66..867b5b35b 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -168,6 +168,11 @@ class CalendarController extends AbstractController public function cancelAction(Calendar $calendar, Request $request): Response { + // Add voter + // Deal with sms being sent or not + // Communicate cancellation with the remote calendar. + + $this->denyAccessUnlessGranted(CalendarVoter::EDIT, $calendar); [$person, $accompanyingPeriod] = [$calendar->getPerson(), $calendar->getAccompanyingPeriod()]; @@ -188,10 +193,11 @@ class CalendarController extends AbstractController $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $this->em->persist($calendar); + + $calendar->setStatus($calendar::STATUS_CANCELED); $this->em->flush(); - $this->addFlash('success', $this->translator->trans('calender.calendar item has been canceled!')); + $this->addFlash('success', $this->translator->trans('chill_calendar.calendar_canceled')); return new RedirectResponse($redirectRoute); }