| @@ 12-24 (lines=13) @@ | ||
| 9 | ||
| 10 | class ExtendedRegisterUserRequest extends RegisterUserRequest implements ErrorResponseProvider |
|
| 11 | { |
|
| 12 | public function getErrorResponse(ConstraintViolationListInterface $errors) |
|
| 13 | { |
|
| 14 | return new JsonResponse([ |
|
| 15 | 'message' => 'Please check your data', |
|
| 16 | 'errors' => array_map(function (ConstraintViolation $violation) { |
|
| 17 | ||
| 18 | return [ |
|
| 19 | 'path' => $violation->getPropertyPath(), |
|
| 20 | 'message' => $violation->getMessage() |
|
| 21 | ]; |
|
| 22 | }, iterator_to_array($errors)) |
|
| 23 | ], 400); |
|
| 24 | } |
|
| 25 | ||
| 26 | } |
|
| @@ 24-35 (lines=12) @@ | ||
| 21 | /** |
|
| 22 | * @inheritdoc |
|
| 23 | */ |
|
| 24 | public function getErrorResponse(ConstraintViolationListInterface $errors) |
|
| 25 | { |
|
| 26 | return new JsonResponse([ |
|
| 27 | 'message' => 'Please check your data', |
|
| 28 | 'errors' => array_map(function (ConstraintViolation $violation) { |
|
| 29 | return [ |
|
| 30 | 'path' => $violation->getPropertyPath(), |
|
| 31 | 'message' => $violation->getMessage() |
|
| 32 | ]; |
|
| 33 | }, iterator_to_array($errors)) |
|
| 34 | ], 400); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||