Reputation: 59571
Do I need to save my custom Zend Validator location to "Zend/Validate"? I'd rather create a folder for all my custom validation scripts, but cannot find anything in the Zend documentation other than changing the namespace.
Here is my error message.
"Plugin by name 'UserNameValidate' was not found in the registry; used paths: Zend_Validate_: Zend/Validate/"
I'd like to tell it to search additional paths.
Upvotes: 1
Views: 1659
Reputation: 59571
I was able to solve my problem using
addElementPrefixPath('Application_Validate',
'../application/validate',
'validate');
Upvotes: 2
Reputation: 238081
I usually keep my custom validators (e.g. My_Validate_Age
) in APPLICATION_PATH/validators
named, e.g. . In this case the php file would be: APPLICATION_PATH/validators/Age.php
. With this setup I need to add the validators path to the Zend_Autoloader. For this purpose in the Bootstrap.php I have:
protected function _initAutoload() {
$autoLoader = Zend_Loader_Autoloader::getInstance();
$resourceLoader = new Zend_Loader_Autoloader_Resource(array(
'basePath' => APPLICATION_PATH,
'namespace' => '',
));
$resourceLoader->addResourceType('validate', 'validators/', 'My_Validate_');
$autoLoader->pushAutoloader($resourceLoader);
}
Hope this will be of help to you.
Upvotes: 1
Reputation: 5454
Did you check the API docs? Zend_Validate has an addDefaultNamespaces method...
public static function addDefaultNamespaces($namespace){
Upvotes: 1