code: private function getFormErrorData(Form $form)
      {
          if ($form->isValid()) {
              // A JsonErrorResponse was created with a valid form-- no errors will be found
              return $this->getResponseData('An error occurred while processing the submitted information');
          }
  
          $errors = $this->getErrors($form);
          $message = $this->getMainErrorMessage($form);
  
          return $this->getResponseData($message, $errors);
      }
docs: Iterates over the given Form returning error information contained within
  
  @todo Handle validation updates -- probably needs a FormView instead of a Form to get field IDs
  
  @param \Symfony\Component\Form\Form $form
  
  @return array