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

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

Returns whether the field is the root of the form tree.
public isRoot ( ) : boolean
Результат boolean
    public function isRoot()
    {
        return !$this->hasParent();
    }

Usage Example

Пример #1
0
 private function getFormErrorMessages(Form $form)
 {
     $errors = [];
     foreach ($form->getErrors() as $key => $error) {
         if ($form->isRoot()) {
             $errors['#root'][] = $error->getMessage();
         } else {
             $errors[] = $error->getMessage();
         }
     }
     foreach ($form->all() as $child) {
         if (!$child->isValid()) {
             $errors[$child->getName()] = $this->getFormErrorMessages($child);
         }
     }
     return $errors;
 }
All Usage Examples Of Symfony\Component\Form\Form::isRoot