badge adapted+ menu entry + persistance of object fixed

This commit is contained in:
2021-11-19 09:46:24 +01:00
parent 57cf46a0af
commit fc8a766c25
7 changed files with 37 additions and 11 deletions

View File

@@ -99,7 +99,7 @@ class AccompanyingCourseController extends Controller
public function indexAction(AccompanyingPeriod $accompanyingCourse): Response
{
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $accompanyingCourse);
// compute some warnings
// get persons without household
$withoutHousehold = [];
@@ -179,7 +179,9 @@ class AccompanyingCourseController extends Controller
if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush();
$em = $this->getDoctrine()->getManager();
$em->persist($accompanyingCourse);
$workflow = $this->registry->get($accompanyingCourse);
if ($workflow->can($accompanyingCourse, 'close')) {
@@ -187,10 +189,16 @@ class AccompanyingCourseController extends Controller
if( count($errors) > 0 ){
return $this->json($errors, 422);
}
$workflow->apply($accompanyingCourse, 'close');
$em->persist($accompanyingCourse);
}
$em->flush();
return $this->redirectToRoute('chill_person_accompanying_course_index', [
'accompanying_period_id' => $accompanyingCourse->getId()
]);
}
return $this->render('@ChillPerson/AccompanyingCourse/close.html.twig', [