Adding an unrelated to issue to an accompanyingCourseWork

This commit is contained in:
2021-12-12 13:55:22 +00:00
committed by Julien Fastré
parent 839fb4a211
commit 683d055088
12 changed files with 687 additions and 578 deletions

View File

@@ -34,6 +34,8 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\Exception\RuntimeException;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Workflow\Registry;
use function array_values;
@@ -294,4 +296,17 @@ final class AccompanyingCourseApiController extends ApiController
return null;
}
protected function validate(string $action, Request $request, string $_format, $entity, array $more = []): ConstraintViolationListInterface
{
if ('work' !== $action) {
return parent::validate($action, $request, $_format, $entity, $more);
}
if (Request::METHOD_POST === $request->getMethod()) {
return $this->getValidator()->validate($more[0], null);
}
return new ConstraintViolationList([]);
}
}