public function serializeFormError(FormInterface $form)
    {
        $errors = $this->formSerializer->createFormErrorArray($form);

        $responseModel = new ResponseFormErrorModel($errors);

        return new JsonResponse($responseModel->getBody(), Response::HTTP_BAD_REQUEST);
    }
public function serializeFormError(FormInterface $form)
    {
        $errors = $this->formSerializer->createFormErrorArray($form);

        $responseModel = new ResponseFormErrorModel($errors);

        return new JsonResponse($responseModel->getBody(), Response::HTTP_BAD_REQUEST);
    }
public function serializeFormError ( FormInterface $ form ) { $ errors = $ this -> formSerializer -> createFormErrorArray ( $ form ) ; $ responseModel = new ResponseFormErrorModel ( $ errors ) ; return new JsonResponse ( $ responseModel -> getBody ( ) , Response :: HTTP_BAD_REQUEST ) ; }
Returns a serialized error response

@param FormInterface $form
@return JsonResponse
Returns a serialized error response