1
0
mirror of synced 2024-12-13 06:46:03 +03:00

Validator now supports all doctrine types

This commit is contained in:
zYne 2006-09-11 20:51:24 +00:00
parent bce726d66c
commit fadef335c4

View File

@ -224,6 +224,27 @@ class Doctrine_Validator {
public function getErrorStack() {
return $this->stack;
}
/**
* converts a doctrine type to native php type
*
* @param $doctrineType
* @return string
*/
public function phpType($doctrineType) {
switch($doctrineType) {
case 'enum':
return 'integer';
case 'blob':
case 'clob':
case 'mbstring':
case 'timestamp':
case 'date':
return 'string';
break;
default:
return $doctrineType;
}
}
/**
* returns whether or not the given variable is
* valid type
@ -237,10 +258,7 @@ class Doctrine_Validator {
return true;
$looseType = self::gettype($var);
if($type == 'enum')
$type = 'integer';
elseif($type == 'date' || $type == 'clob')
$type = 'string';
$type = self::phpType($type);
switch($looseType):
case 'float':