public function alterValid(Form $form, Form $mainForm, &$isValid)
    {
        // Alter the form itself
        $messages = $form->alterValid($mainForm, $isValid);

        // Add messages to the existing Bag
        if ($messages) {
            $messageBag = $mainForm->getValidator()->getMessageBag();
            $this->appendMessagesWithPrefix($messageBag, $form->getName(), $messages);
        }

        // Alter the form's child forms recursively
        foreach ($form->getFields() as $name => $field) {
            if (method_exists($field, 'alterValid')) {
                $field->alterValid($mainForm, $isValid);
            }
        }
    }
public function alterValid(Form $form, Form $mainForm, &$isValid)
    {
        // Alter the form itself
        $messages = $form->alterValid($mainForm, $isValid);

        // Add messages to the existing Bag
        if ($messages) {
            $messageBag = $mainForm->getValidator()->getMessageBag();
            $this->appendMessagesWithPrefix($messageBag, $form->getName(), $messages);
        }

        // Alter the form's child forms recursively
        foreach ($form->getFields() as $name => $field) {
            if (method_exists($field, 'alterValid')) {
                $field->alterValid($mainForm, $isValid);
            }
        }
    }
public function alterValid ( Form $ form , Form $ mainForm , & $ isValid ) { // Alter the form itself $ messages = $ form -> alterValid ( $ mainForm , $ isValid ) ; // Add messages to the existing Bag if ( $ messages ) { $ messageBag = $ mainForm -> getValidator ( ) -> getMessageBag ( ) ; $ this -> appendMessagesWithPrefix ( $ messageBag , $ form -> getName ( ) , $ messages ) ; } // Alter the form's child forms recursively foreach ( $ form -> getFields ( ) as $ name => $ field ) { if ( method_exists ( $ field , 'alterValid' ) ) { $ field -> alterValid ( $ mainForm , $ isValid ) ; } } }
Alter a form's validity recursively, and add messages with nested form prefix.

@return void
Alter a form s validity recursively and add messages with nested form prefix .