Search code examples
zend-frameworkvalidationzend-validate

Zend custom validator not found on remote server


I know that there are some similar questions, but the answers from there don't help me.

The application worked alright locally, but now, among other problems, the classes of the custom validators i made are not found, although some model classes (i haven't tested all yet) work. It doesn't seem to be a problem of case sensitivity, class names, file names or folder names.

Could there be some other causes?


Solution

  • I resolved this problem maybe a week ago. It was a problem with the path to library. I did it like this:

    In public/index.php:

    defined('LIBRARY_PATH') || define('LIBRARY_PATH', realpath(dirname(__FILE__) . '/../library'));
    

    And in application/Bootsrap.php I have something like:

    protected function _initAutoload() {
    
        // configure new autoloader
        $autoloader = new Zend_Application_Module_Autoloader ( array ('namespace' => '', 'basePath' => LIBRARY_PATH ) );
    
        // autoload validators definition
        $autoloader->addResourceType ( 'Validator', '/validate', 'MyValidate' );
    }