src/xPDO/Om/xPDOObject.php
public function addValidationRule($field, $name, $type, $rule, array $parameters= array()) {
        $field = $this->getField($field);
        if (is_string($field)) {
            if (!$this->_validationLoaded) $this->_loadValidation();
            if (!isset($this->_validationRules[$field])) $this->_validationRules[$field]= array();
            $this->_validationRules[$field][$name]= array(
                'type' => $type,
                'rule' => $rule,
                'parameters' => array()
            );
            foreach ($parameters as $paramKey => $paramValue) {
                $this->_validationRules[$field][$name]['parameters'][$paramKey]= $paramValue;
            }
        }
    }
public function addValidationRule($field, $name, $type, $rule, array $parameters= array()) {
        $field = $this->getField($field);
        if (is_string($field)) {
            if (!$this->_validationLoaded) $this->_loadValidation();
            if (!isset($this->_validationRules[$field])) $this->_validationRules[$field]= array();
            $this->_validationRules[$field][$name]= array(
                'type' => $type,
                'rule' => $rule,
                'parameters' => array()
            );
            foreach ($parameters as $paramKey => $paramValue) {
                $this->_validationRules[$field][$name]['parameters'][$paramKey]= $paramValue;
            }
        }
    }
public function addValidationRule ( $ field , $ name , $ type , $ rule , array $ parameters = array ( ) ) { $ field = $ this -> getField ( $ field ) ; if ( is_string ( $ field ) ) { if ( ! $ this -> _validationLoaded ) $ this -> _loadValidation ( ) ; if ( ! isset ( $ this -> _validationRules [ $ field ] ) ) $ this -> _validationRules [ $ field ] = array ( ) ; $ this -> _validationRules [ $ field ] [ $ name ] = array ( 'type' => $ type , 'rule' => $ rule , 'parameters' => array ( ) ) ; foreach ( $ parameters as $ paramKey => $ paramValue ) { $ this -> _validationRules [ $ field ] [ $ name ] [ 'parameters' ] [ $ paramKey ] = $ paramValue ; } } }
Add a validation rule to an object field for this instance.

@param string $field The field key to apply the rule to.
@param string $name A name to identify the rule.
@param string $type The type of rule.
@param string $rule The rule definition.
@param array $parameters Any input parameters for the rule.
Add a validation rule to an object field for this instance .