Commit fadef335 authored by zYne's avatar zYne

Validator now supports all doctrine types

parent bce726d6
......@@ -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':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment