diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index fcef698ad..7af13ccd4 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -43,10 +43,10 @@ class AccompanyingCourseController extends Controller private Registry $registry; - private AccompanyingPeriodWorkRepository $workRepository; - private TranslatorInterface $translator; + private AccompanyingPeriodWorkRepository $workRepository; + public function __construct( SerializerInterface $serializer, EventDispatcherInterface $dispatcher, @@ -72,7 +72,7 @@ class AccompanyingCourseController extends Controller $this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse); $form = $this->createForm(AccompanyingCourseType::class, $accompanyingCourse, [ - 'validation_groups' => [AccompanyingPeriod::STEP_CLOSED] + 'validation_groups' => [AccompanyingPeriod::STEP_CLOSED], ]); $form->handleRequest($request); @@ -83,7 +83,6 @@ class AccompanyingCourseController extends Controller $workflow = $this->registry->get($accompanyingCourse); if ($workflow->can($accompanyingCourse, 'close')) { - $workflow->apply($accompanyingCourse, 'close'); $em->flush(); @@ -91,15 +90,14 @@ class AccompanyingCourseController extends Controller return $this->redirectToRoute('chill_person_accompanying_course_index', [ 'accompanying_period_id' => $accompanyingCourse->getId(), ]); - } else { - /** @var ConstraintViolationListInterface $errors */ - $errors = $this->validator->validate($accompanyingCourse, null, [$accompanyingCourse::STEP_CLOSED]); - $this->addFlash('error', $this->translator->trans('It is not possible to close this course')); + } + /** @var ConstraintViolationListInterface $errors */ + $errors = $this->validator->validate($accompanyingCourse, null, [$accompanyingCourse::STEP_CLOSED]); + $this->addFlash('error', $this->translator->trans('It is not possible to close this course')); - foreach ($errors as $e) { - /** @var ConstraintViolationInterface $e */ - $this->addFlash('error', $e->getMessage()); - } + foreach ($errors as $e) { + /** @var ConstraintViolationInterface $e */ + $this->addFlash('error', $e->getMessage()); } }