public function php($data)
    {
        $valid = true;

        // If we want to ignore validation
        if (get_class($this->form->getRequestHandler()->buttonClicked()) === 'FormActionNoValidation') {
            return $valid;
        }

        // validate against form field validators
        $fields = $this->form->Fields();
        foreach ($fields as $field) {
            $valid = ($field->validate($this) && $valid);
        }

        // validate against ZenValidator constraints
        foreach ($this->constraints as $fieldName => $constraints) {
            $field = $this->form->Fields()->dataFieldByName($fieldName);

            if (!$field) {
                continue;
            }

            if ($field->validationApplies()) {
                foreach ($constraints as $constraint) {
                    if (!$constraint->validate($data[$fieldName])) {
                        $this->validationError($fieldName, $constraint->getMessage(), 'required');
                        $valid = false;
                        $this->debug("Validation (".get_class($constraint).") failed for $fieldName with message: " . $constraint->getMessage());
                    }
                }
            }
        }

        return $valid;
    }
public function php($data)
    {
        $valid = true;

        // If we want to ignore validation
        if (get_class($this->form->getRequestHandler()->buttonClicked()) === 'FormActionNoValidation') {
            return $valid;
        }

        // validate against form field validators
        $fields = $this->form->Fields();
        foreach ($fields as $field) {
            $valid = ($field->validate($this) && $valid);
        }

        // validate against ZenValidator constraints
        foreach ($this->constraints as $fieldName => $constraints) {
            $field = $this->form->Fields()->dataFieldByName($fieldName);

            if (!$field) {
                continue;
            }

            if ($field->validationApplies()) {
                foreach ($constraints as $constraint) {
                    if (!$constraint->validate($data[$fieldName])) {
                        $this->validationError($fieldName, $constraint->getMessage(), 'required');
                        $valid = false;
                        $this->debug("Validation (".get_class($constraint).") failed for $fieldName with message: " . $constraint->getMessage());
                    }
                }
            }
        }

        return $valid;
    }
public function php ( $ data ) { $ valid = true ; // If we want to ignore validation if ( get_class ( $ this -> form -> getRequestHandler ( ) -> buttonClicked ( ) ) === 'FormActionNoValidation' ) { return $ valid ; } // validate against form field validators $ fields = $ this -> form -> Fields ( ) ; foreach ( $ fields as $ field ) { $ valid = ( $ field -> validate ( $ this ) && $ valid ) ; } // validate against ZenValidator constraints foreach ( $ this -> constraints as $ fieldName => $ constraints ) { $ field = $ this -> form -> Fields ( ) -> dataFieldByName ( $ fieldName ) ; if ( ! $ field ) { continue ; } if ( $ field -> validationApplies ( ) ) { foreach ( $ constraints as $ constraint ) { if ( ! $ constraint -> validate ( $ data [ $ fieldName ] ) ) { $ this -> validationError ( $ fieldName , $ constraint -> getMessage ( ) , 'required' ) ; $ valid = false ; $ this -> debug ( "Validation (" . get_class ( $ constraint ) . ") failed for $fieldName with message: " . $ constraint -> getMessage ( ) ) ; } } } } return $ valid ; }
Performs the php validation on all ZenValidatorConstraints attached to this validator

@return boolean
Performs the php validation on all ZenValidatorConstraints attached to this validator