php - Using Custom Zend Validator in INI file -
i don't have custom zend_form , declared elements in ini file. there no problem creating zend_form ini file, having problem using own custom validator in ini file. return not found in registry error.
currently, code this.
[bootstrap] $resourceloader = new zend_loader_autoloader_resource(array( 'namespace' => 'my', 'basepath' => dirname(__file__) )); $resourceloader->addresourcetype('validator', 'forms/validate/', 'form_validate'); [ini file] form.elements.new_password.options.validators.password.validator = "password" [custom validator] <?php class my_form_validate_password extends zend_validate_abstract { ......
please tell me i'm missing here. thanks!
this case of on thinking:
i'm going assume you're using version of zf1.x that's new (v1.10 , newer).
you have file called project/application/configs/application.ini
in standard application.ini line:
includepaths.library = application_path "/../library"
this tells of our library code (a custom validator qualifies) belong directory @ path.
also there line:
autoloadernamespaces[] = "my_"
this tells name of our library (defines directory below /library).
so our custom validator my_form_validate_password
live at:
project /library /my /form /validate password.php
nothing else required, bootstrap code needed if going not anticipated zend framework, validators not typically registered resources.
the class can called
$validator = new my_form_validate_password();
as usual , other access method should work well.
Comments
Post a Comment