Commit fadef335 authored by zYne's avatar zYne

Validator now supports all doctrine types

parent bce726d6
...@@ -224,6 +224,27 @@ class Doctrine_Validator { ...@@ -224,6 +224,27 @@ class Doctrine_Validator {
public function getErrorStack() { public function getErrorStack() {
return $this->stack; 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 * returns whether or not the given variable is
* valid type * valid type
...@@ -237,10 +258,7 @@ class Doctrine_Validator { ...@@ -237,10 +258,7 @@ class Doctrine_Validator {
return true; return true;
$looseType = self::gettype($var); $looseType = self::gettype($var);
if($type == 'enum') $type = self::phpType($type);
$type = 'integer';
elseif($type == 'date' || $type == 'clob')
$type = 'string';
switch($looseType): switch($looseType):
case 'float': 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