Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | public function onKernelException(GetResponseForExceptionEvent $event) |
||
42 | { |
||
43 | $exception = $event->getException(); |
||
44 | |||
45 | if (!$exception instanceof ValidationException) { |
||
46 | return; |
||
47 | } |
||
48 | |||
49 | $event->setResponse(new Response( |
||
50 | $this->serializer->serialize($exception->getConstraintViolationList(), $event->getRequest()->getRequestFormat()), |
||
51 | Response::HTTP_BAD_REQUEST |
||
52 | )); |
||
53 | } |
||
54 | } |
||
55 |