protected function getValidator($name, $annotation) {
        $validate = array();
        switch($name) {
            case 'NotBlank':
            case 'NotNull':
                $validate['type'] = "presence";
                break;
            case 'Email':
                $validate['type'] = "email";
                break;
            case 'Length':
                $validate['type'] = "length";
                $validate['max'] = (int)$annotation->max;
                $validate['min'] = (int)$annotation->min;
                break;
            case 'Regex':
                if ($annotation->match) {
                    $validate['type'] = "format";
                    $validate['matcher']['skipEncode'] = true;
                    $validate['matcher']['value'] = $annotation->pattern;
                }
                break;
            case 'MaxLength':
            case 'MinLength':
                $validate['type'] = "length";
                if ($name == "MaxLength") {
                    $validate['max'] = (int)$annotation->limit;
                } else {
                    $validate['min'] = (int)$annotation->limit;
                }
                break;
            case 'Choice':
                $validate['type'] = "inclusion";
                $validate['list'] = $annotation->choices;
                break;
            default:
                $validate['type'] = strtolower($name);
                $validate += get_object_vars($annotation);
                break;
        }
        return $validate;
    }
protected function getValidator($name, $annotation) {
        $validate = array();
        switch($name) {
            case 'NotBlank':
            case 'NotNull':
                $validate['type'] = "presence";
                break;
            case 'Email':
                $validate['type'] = "email";
                break;
            case 'Length':
                $validate['type'] = "length";
                $validate['max'] = (int)$annotation->max;
                $validate['min'] = (int)$annotation->min;
                break;
            case 'Regex':
                if ($annotation->match) {
                    $validate['type'] = "format";
                    $validate['matcher']['skipEncode'] = true;
                    $validate['matcher']['value'] = $annotation->pattern;
                }
                break;
            case 'MaxLength':
            case 'MinLength':
                $validate['type'] = "length";
                if ($name == "MaxLength") {
                    $validate['max'] = (int)$annotation->limit;
                } else {
                    $validate['min'] = (int)$annotation->limit;
                }
                break;
            case 'Choice':
                $validate['type'] = "inclusion";
                $validate['list'] = $annotation->choices;
                break;
            default:
                $validate['type'] = strtolower($name);
                $validate += get_object_vars($annotation);
                break;
        }
        return $validate;
    }
protected function getValidator ( $ name , $ annotation ) { $ validate = array ( ) ; switch ( $ name ) { case 'NotBlank' : case 'NotNull' : $ validate [ 'type' ] = "presence" ; break ; case 'Email' : $ validate [ 'type' ] = "email" ; break ; case 'Length' : $ validate [ 'type' ] = "length" ; $ validate [ 'max' ] = ( int ) $ annotation -> max ; $ validate [ 'min' ] = ( int ) $ annotation -> min ; break ; case 'Regex' : if ( $ annotation -> match ) { $ validate [ 'type' ] = "format" ; $ validate [ 'matcher' ] [ 'skipEncode' ] = true ; $ validate [ 'matcher' ] [ 'value' ] = $ annotation -> pattern ; } break ; case 'MaxLength' : case 'MinLength' : $ validate [ 'type' ] = "length" ; if ( $ name == "MaxLength" ) { $ validate [ 'max' ] = ( int ) $ annotation -> limit ; } else { $ validate [ 'min' ] = ( int ) $ annotation -> limit ; } break ; case 'Choice' : $ validate [ 'type' ] = "inclusion" ; $ validate [ 'list' ] = $ annotation -> choices ; break ; default : $ validate [ 'type' ] = strtolower ( $ name ) ; $ validate += get_object_vars ( $ annotation ) ; break ; } return $ validate ; }
Get the Ext JS Validator

@param string $name
@param array $annotation
@return array
Get the Ext JS Validator