From f2bf88ec908008ad0374a4c14bf9afd42211321c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 19 Nov 2021 08:45:28 +0100 Subject: [PATCH] adjustment to apply validation --- .../Controller/AccompanyingCourseController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index c9b9cee35..43c516ca9 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -183,6 +183,11 @@ class AccompanyingCourseController extends Controller $workflow = $this->registry->get($accompanyingCourse); if ($workflow->can($accompanyingCourse, 'close')) { + $errors = $this->validator->validate($accompanyingCourse, null, [$accompanyingCourse::STEP_CLOSED]); + if( count($errors) > 0 ){ + return $this->json($errors, 422); + } + $workflow->apply($accompanyingCourse, 'close'); }