2009年5月14日星期四

[fw-mvc] Autoloader and Zend_Validate/Zend_Filter namespaces

Hi all

I´m trying to update our application to ZF 1.8 and I´m having issues with Zend_Validate (and Zend_Filter) namespace feature.

I subclassed Zend_Validate with Vilage_Validate and overriden the static method Zend_Validate::is(), prepending our namespace:

public static function is($value, $classBaseName, array $args = array(), $namespaces = array())
{
    $namespaces = array_merge(array('Vilage_Validate'), (array) $namespaces);
    return parent::is($value, $classBaseName, $args, $namespaces);
}

When I try to load a custom validator (eg Vilage_Validate_MyValidate) using Vilage_Validate::is($value, 'MyValidator') everything works as expected. But when I try to load a builtin validator (eg Zend_Validate_Alpha) using Vilage_Validate::is($value, 'Alpha') I´m getting warnings that Zend_Loader couldn´t find Vilage/Validate/MyValidate.php, as it tries to load from first namespace.

I tried enabling Zend_Loader_Autoloader::supressNotFoundWarnings() but I´m still getting these warnings.

There is any way to keep the same behaviour with the new Autoloader?

Thanks in advance,

Luiz Damim

没有评论: