Symfony\Component\Form\Form::getErrors PHP Метод

getErrors() публичный Метод

Returns all errors.
public getErrors ( ) : array
Результат array An array of FormError instances that occurred during binding
    public function getErrors()
    {
        return $this->errors;
    }

Usage Example

Пример #1
2
 private function convertFormToArray(GenericSerializationVisitor $visitor, Form $data)
 {
     $isRoot = null === $visitor->getRoot();
     $form = new \ArrayObject();
     $errors = [];
     foreach ($data->getErrors() as $error) {
         $errors[] = $this->getErrorMessage($error);
     }
     if (!empty($errors)) {
         $form['errors'] = $errors;
     }
     $children = [];
     foreach ($data->all() as $child) {
         if ($child instanceof Form) {
             $children[$child->getName()] = $this->convertFormToArray($visitor, $child);
         }
     }
     if (!empty($children)) {
         $form['children'] = $children;
     }
     if ($isRoot) {
         $visitor->setRoot($form);
     }
     return $form;
 }
All Usage Examples Of Symfony\Component\Form\Form::getErrors