public static function doValidate($dbName, $tableName, $columns)
    {
        $dbMap = Propel::getDatabaseMap($dbName);
        $tableMap = $dbMap->getTable($tableName);
        $failureMap = array(); // map of ValidationFailed objects
        foreach ($columns as $colName => $colValue) {
            if ($tableMap->hasColumn($colName)) {
                $col = $tableMap->getColumn($colName);
                foreach ($col->getValidators() as $validatorMap) {
                    $validator = BasePeer::getValidator($validatorMap->getClass());
                    if ($validator && ($col->isNotNull() || $colValue !== null) && $validator->isValid($validatorMap, $colValue) === false) {
                        // for now we do one ValidationFailed per column, not per rule
                        if (!isset($failureMap[$colName])) {
                            $failureMap[$colName] = new ValidationFailed($colName, $validatorMap->getMessage(), $validator);
                            break;
                        }
                    }
                }
            }
        }

        return (!empty($failureMap) ? $failureMap : true);
    }
public static function doValidate($dbName, $tableName, $columns)
    {
        $dbMap = Propel::getDatabaseMap($dbName);
        $tableMap = $dbMap->getTable($tableName);
        $failureMap = array(); // map of ValidationFailed objects
        foreach ($columns as $colName => $colValue) {
            if ($tableMap->hasColumn($colName)) {
                $col = $tableMap->getColumn($colName);
                foreach ($col->getValidators() as $validatorMap) {
                    $validator = BasePeer::getValidator($validatorMap->getClass());
                    if ($validator && ($col->isNotNull() || $colValue !== null) && $validator->isValid($validatorMap, $colValue) === false) {
                        // for now we do one ValidationFailed per column, not per rule
                        if (!isset($failureMap[$colName])) {
                            $failureMap[$colName] = new ValidationFailed($colName, $validatorMap->getMessage(), $validator);
                            break;
                        }
                    }
                }
            }
        }

        return (!empty($failureMap) ? $failureMap : true);
    }
public static function doValidate ( $ dbName , $ tableName , $ columns ) { $ dbMap = Propel :: getDatabaseMap ( $ dbName ) ; $ tableMap = $ dbMap -> getTable ( $ tableName ) ; $ failureMap = array ( ) ; // map of ValidationFailed objects foreach ( $ columns as $ colName => $ colValue ) { if ( $ tableMap -> hasColumn ( $ colName ) ) { $ col = $ tableMap -> getColumn ( $ colName ) ; foreach ( $ col -> getValidators ( ) as $ validatorMap ) { $ validator = BasePeer :: getValidator ( $ validatorMap -> getClass ( ) ) ; if ( $ validator && ( $ col -> isNotNull ( ) || $ colValue !== null ) && $ validator -> isValid ( $ validatorMap , $ colValue ) === false ) { // for now we do one ValidationFailed per column, not per rule if ( ! isset ( $ failureMap [ $ colName ] ) ) { $ failureMap [ $ colName ] = new ValidationFailed ( $ colName , $ validatorMap -> getMessage ( ) , $ validator ) ; break ; } } } } } return ( ! empty ( $ failureMap ) ? $ failureMap : true ) ; }
Applies any validators that were defined in the schema to the specified columns.

@param string $dbName    The name of the database
@param string $tableName The name of the table
@param array  $columns   Array of column names as key and column values as value.

@return ValidationFailed[]|bool A list of validation failures, true if valid.
Applies any validators that were defined in the schema to the specified columns .