mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
cs: Fix AccompanyingCourseController
.
This commit is contained in:
parent
cd55e80275
commit
0248dddc9e
@ -43,10 +43,10 @@ class AccompanyingCourseController extends Controller
|
|||||||
|
|
||||||
private Registry $registry;
|
private Registry $registry;
|
||||||
|
|
||||||
private AccompanyingPeriodWorkRepository $workRepository;
|
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
private TranslatorInterface $translator;
|
||||||
|
|
||||||
|
private AccompanyingPeriodWorkRepository $workRepository;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
SerializerInterface $serializer,
|
SerializerInterface $serializer,
|
||||||
EventDispatcherInterface $dispatcher,
|
EventDispatcherInterface $dispatcher,
|
||||||
@ -72,7 +72,7 @@ class AccompanyingCourseController extends Controller
|
|||||||
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse);
|
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::EDIT, $accompanyingCourse);
|
||||||
|
|
||||||
$form = $this->createForm(AccompanyingCourseType::class, $accompanyingCourse, [
|
$form = $this->createForm(AccompanyingCourseType::class, $accompanyingCourse, [
|
||||||
'validation_groups' => [AccompanyingPeriod::STEP_CLOSED]
|
'validation_groups' => [AccompanyingPeriod::STEP_CLOSED],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
@ -83,7 +83,6 @@ class AccompanyingCourseController extends Controller
|
|||||||
$workflow = $this->registry->get($accompanyingCourse);
|
$workflow = $this->registry->get($accompanyingCourse);
|
||||||
|
|
||||||
if ($workflow->can($accompanyingCourse, 'close')) {
|
if ($workflow->can($accompanyingCourse, 'close')) {
|
||||||
|
|
||||||
$workflow->apply($accompanyingCourse, 'close');
|
$workflow->apply($accompanyingCourse, 'close');
|
||||||
|
|
||||||
$em->flush();
|
$em->flush();
|
||||||
@ -91,7 +90,7 @@ class AccompanyingCourseController extends Controller
|
|||||||
return $this->redirectToRoute('chill_person_accompanying_course_index', [
|
return $this->redirectToRoute('chill_person_accompanying_course_index', [
|
||||||
'accompanying_period_id' => $accompanyingCourse->getId(),
|
'accompanying_period_id' => $accompanyingCourse->getId(),
|
||||||
]);
|
]);
|
||||||
} else {
|
}
|
||||||
/** @var ConstraintViolationListInterface $errors */
|
/** @var ConstraintViolationListInterface $errors */
|
||||||
$errors = $this->validator->validate($accompanyingCourse, null, [$accompanyingCourse::STEP_CLOSED]);
|
$errors = $this->validator->validate($accompanyingCourse, null, [$accompanyingCourse::STEP_CLOSED]);
|
||||||
$this->addFlash('error', $this->translator->trans('It is not possible to close this course'));
|
$this->addFlash('error', $this->translator->trans('It is not possible to close this course'));
|
||||||
@ -101,7 +100,6 @@ class AccompanyingCourseController extends Controller
|
|||||||
$this->addFlash('error', $e->getMessage());
|
$this->addFlash('error', $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('@ChillPerson/AccompanyingCourse/close.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingCourse/close.html.twig', [
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user