As part of Zend, where should I put a custom validator?

I put the class under application \ validate \ PasswordConfirmation.php

And it does not work.


Error Class 'Default_Validate_PasswordConfirmation' not found

still happening.

Does anyone have this problem before?

+3
source share
3 answers

Let me answer my own question:

I successfully add a validator according to this post: Where should My_Validate_PasswordConfirmation be located within Zend?

+1
source

I usually put them in /library/CV/Validate/

Example:

/library/CV/Validate/EmpresaNueva.php:
class CV_Validate_EmpresaNueva extends Zend_Validate_Abstract {
    //Validator code
}

Where the library is the place where you have Zend.

The contents of index.php @ / public:

$root = dirname(dirname(__FILE__));

set_include_path($root.'/application' . PATH_SEPARATOR
    .$root.'/library' . PATH_SEPARATOR
    . get_include_path()
);
+1
source

, . , , Zend_Validate::addValidator().

For more information, see. In documentation .

+1
source

Source: https://habr.com/ru/post/1710774/


All Articles