protected function validate()
    {
        $this->isValid = true;

        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
            if ($writable instanceof FieldInterface) {
                $writable->validate();
            }
        }

        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
            if (array_key_exists($name, $this->validators) === true) {
                foreach ($this->validators[$name] as $validator) {
                    call_user_func_array($validator, [$writable, $this]);
                }
            }
        }

        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
            if ($writable instanceof FieldInterface && $writable->isValid() === false) {
                $this->isValid = false;
                $this->addError("Please correct the indicated errors and resubmit the form.");
                break;
            }
        }

        foreach ($this->getWritableBearer()->getWritables() as $writable) {
            // Force validation on each subform via isValid()
            // If subform isn't valid and this form is not yet invalid, mark it as invalid
            if ($writable instanceof FormInterface) {
                if ($writable->isValid() === false && $this->isValid === true) {
                    $this->isValid = false;
                    $this->addError("Please correct the indicated errors and resubmit the form.");
                }
            }
        }

        if ($this->errors !== []) {
            $this->isValid = false;
        }
    }
protected function validate()
    {
        $this->isValid = true;

        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
            if ($writable instanceof FieldInterface) {
                $writable->validate();
            }
        }

        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
            if (array_key_exists($name, $this->validators) === true) {
                foreach ($this->validators[$name] as $validator) {
                    call_user_func_array($validator, [$writable, $this]);
                }
            }
        }

        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
            if ($writable instanceof FieldInterface && $writable->isValid() === false) {
                $this->isValid = false;
                $this->addError("Please correct the indicated errors and resubmit the form.");
                break;
            }
        }

        foreach ($this->getWritableBearer()->getWritables() as $writable) {
            // Force validation on each subform via isValid()
            // If subform isn't valid and this form is not yet invalid, mark it as invalid
            if ($writable instanceof FormInterface) {
                if ($writable->isValid() === false && $this->isValid === true) {
                    $this->isValid = false;
                    $this->addError("Please correct the indicated errors and resubmit the form.");
                }
            }
        }

        if ($this->errors !== []) {
            $this->isValid = false;
        }
    }
protected function validate ( ) { $ this -> isValid = true ; foreach ( $ this -> getWritableBearer ( ) -> getWritables ( ) as $ name => $ writable ) { if ( $ writable instanceof FieldInterface ) { $ writable -> validate ( ) ; } } foreach ( $ this -> getWritableBearer ( ) -> getWritables ( ) as $ name => $ writable ) { if ( array_key_exists ( $ name , $ this -> validators ) === true ) { foreach ( $ this -> validators [ $ name ] as $ validator ) { call_user_func_array ( $ validator , [ $ writable , $ this ] ) ; } } } foreach ( $ this -> getWritableBearer ( ) -> getWritables ( ) as $ name => $ writable ) { if ( $ writable instanceof FieldInterface && $ writable -> isValid ( ) === false ) { $ this -> isValid = false ; $ this -> addError ( "Please correct the indicated errors and resubmit the form." ) ; break ; } } foreach ( $ this -> getWritableBearer ( ) -> getWritables ( ) as $ writable ) { // Force validation on each subform via isValid() // If subform isn't valid and this form is not yet invalid, mark it as invalid if ( $ writable instanceof FormInterface ) { if ( $ writable -> isValid ( ) === false && $ this -> isValid === true ) { $ this -> isValid = false ; $ this -> addError ( "Please correct the indicated errors and resubmit the form." ) ; } } } if ( $ this -> errors !== [ ] ) { $ this -> isValid = false ; } }
Determine whether the form is valid.

Updates $this->isValid and $this->errors according to whether the form is
valid and whether it has errors.

@return void
Determine whether the form is valid .