(on Thursday, 14 May 2009, 08:07 AM -0300):
> 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?
This may have been due to the fact that Zend_Validate was calling
Zend_Loader::loadClass internally. I've just committed changes to it
that now perform essentially this:
if (!class_exists($class)) {
Zend_Loader::loadClass($class);
}
which will allow it to attempt to autoload the class first, and only
then fall back on using loadClass(). This may get rid of the warnings
you're seeing.
--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论