/**
  * Add a new form to the error form context
  *
  * @param BaseForm $form the errored form
  * @return $this
  */
 public function addForm(BaseForm $form)
 {
     $formErrorInformation = $this->request->getSession()->getFormErrorInformation();
     $this->set(get_class($form) . ":" . $form->getType(), $form);
     // Set form error information
     $formErrorInformation[get_class($form) . ":" . $form->getType()] = ['data' => $this->cleanFormData($form->getForm()->getData()), 'hasError' => $form->hasError(), 'errorMessage' => $form->getErrorMessage(), 'method' => $this->request->getMethod(), 'timestamp' => time(), 'validation_groups' => $form->getForm()->getConfig()->getOption('validation_groups')];
     $this->request->getSession()->setFormErrorInformation($formErrorInformation);
     return $this;
 }
 /**
  * Add a new form to the error form context
  *
  * @param BaseForm $form the errored form
  * @return $this
  */
 public function addForm(BaseForm $form)
 {
     $formErrorInformation = $this->request->getSession()->getFormErrorInformation();
     $this->set(get_class($form) . ":" . $form->getType(), $form);
     /** Remove unserializable objects \Symfony\Component\HttpFoundation\File\UploadedFile */
     $formData = $form->getForm()->getData();
     foreach ($formData as $idx => $value) {
         if ($value instanceof UploadedFile) {
             unset($formData[$idx]);
         }
     }
     // Set form error information
     $formErrorInformation[get_class($form) . ":" . $form->getType()] = ['data' => $formData, 'hasError' => $form->hasError(), 'errorMessage' => $form->getErrorMessage(), 'method' => $this->request->getMethod(), 'timestamp' => time(), 'validation_groups' => $form->getForm()->getConfig()->getOption('validation_groups')];
     $this->request->getSession()->setFormErrorInformation($formErrorInformation);
     return $this;
 }