src/xPDO/xPDO.php
public function getValidationRules($className) {
        $rules= array();
        if ($className= $this->loadClass($className)) {
            if ($ancestry= $this->getAncestry($className)) {
                for ($i= count($ancestry) - 1; $i >= 0; $i--) {
                    if (isset($this->map[$ancestry[$i]]['validation']['rules'])) {
                        $rules= array_merge($rules, $this->map[$ancestry[$i]]['validation']['rules']);
                    }
                }
            }
            if ($this->getInherit($className) === 'single') {
                $descendants= $this->getDescendants($className);
                if ($descendants) {
                    foreach ($descendants as $descendant) {
                        $descendantClass= $this->loadClass($descendant);
                        if ($descendantClass && isset($this->map[$descendantClass]['validation']['rules'])) {
                            $rules= array_merge($rules, array_diff_key($this->map[$descendantClass]['validation']['rules'], $rules));
                        }
                    }
                }
            }
            if ($this->getDebug() === true) {
                $this->log(xPDO::LOG_LEVEL_DEBUG, "Returning validation rules: " . print_r($rules, true));
            }
        }
        return $rules;
    }
public function getValidationRules($className) {
        $rules= array();
        if ($className= $this->loadClass($className)) {
            if ($ancestry= $this->getAncestry($className)) {
                for ($i= count($ancestry) - 1; $i >= 0; $i--) {
                    if (isset($this->map[$ancestry[$i]]['validation']['rules'])) {
                        $rules= array_merge($rules, $this->map[$ancestry[$i]]['validation']['rules']);
                    }
                }
            }
            if ($this->getInherit($className) === 'single') {
                $descendants= $this->getDescendants($className);
                if ($descendants) {
                    foreach ($descendants as $descendant) {
                        $descendantClass= $this->loadClass($descendant);
                        if ($descendantClass && isset($this->map[$descendantClass]['validation']['rules'])) {
                            $rules= array_merge($rules, array_diff_key($this->map[$descendantClass]['validation']['rules'], $rules));
                        }
                    }
                }
            }
            if ($this->getDebug() === true) {
                $this->log(xPDO::LOG_LEVEL_DEBUG, "Returning validation rules: " . print_r($rules, true));
            }
        }
        return $rules;
    }
public function getValidationRules ( $ className ) { $ rules = array ( ) ; if ( $ className = $ this -> loadClass ( $ className ) ) { if ( $ ancestry = $ this -> getAncestry ( $ className ) ) { for ( $ i = count ( $ ancestry ) - 1 ; $ i >= 0 ; $ i -- ) { if ( isset ( $ this -> map [ $ ancestry [ $ i ] ] [ 'validation' ] [ 'rules' ] ) ) { $ rules = array_merge ( $ rules , $ this -> map [ $ ancestry [ $ i ] ] [ 'validation' ] [ 'rules' ] ) ; } } } if ( $ this -> getInherit ( $ className ) === 'single' ) { $ descendants = $ this -> getDescendants ( $ className ) ; if ( $ descendants ) { foreach ( $ descendants as $ descendant ) { $ descendantClass = $ this -> loadClass ( $ descendant ) ; if ( $ descendantClass && isset ( $ this -> map [ $ descendantClass ] [ 'validation' ] [ 'rules' ] ) ) { $ rules = array_merge ( $ rules , array_diff_key ( $ this -> map [ $ descendantClass ] [ 'validation' ] [ 'rules' ] , $ rules ) ) ; } } } } if ( $ this -> getDebug ( ) === true ) { $ this -> log ( xPDO :: LOG_LEVEL_DEBUG , "Returning validation rules: " . print_r ( $ rules , true ) ) ; } } return $ rules ; }
Gets a set of validation rules defined for an object by class name.

@param string $className The name of the class to lookup validation rules
for.
@return array An array featuring field names as the array keys, and
arrays of validation rule information as the array values; empty array is
returned if unsuccessful.
Gets a set of validation rules defined for an object by class name .