adjustment to apply validation

This commit is contained in:
Julie Lenaerts 2021-11-19 08:45:28 +01:00
parent 6c48a22f86
commit f2bf88ec90

View File

@ -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');
}