views:

261

answers:

3

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

And it doesn't work.

Error
Class 'Default_Validate_PasswordConfirmation' not found

still occurs.

Does anyone have this problem before?

+1  A: 

I usually place them at /library/CV/Validate/

Example:

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

Where library is the place where you have Zend.

Content of index.php @ /public:

$root = dirname(dirname(__FILE__));

set_include_path($root.'/application' . PATH_SEPARATOR
    .$root.'/library' . PATH_SEPARATOR
    . get_include_path()
);
Macarse
I try to place the file under library/My/Validate/PasswordConfirmation.php. But the Class "'Default_Validate_PasswordConfirmation' not found" still occurs. Do I miss any steps?
Billy
I try to place the file under library/Default/Validate/PasswordConfirmation.php
Billy
Check the edit. library/ es where Zend folder is placed. Don't know where you have yours.
Macarse
+1  A: 

For customer validators, you need to put them in a location that is on your include path. Also, you need to add your validator to make it available using Zend_Validate::addValidator().

See the documentation for more information.

Kieran Hall
I add the validator successfully according to this post:http://stackoverflow.com/questions/1010265/where-should-myvalidatepasswordconfirmation-put-in-zend-framework
Billy
A: 

Let me answer my own question:

I add the validator successfully according to this post: http://stackoverflow.com/questions/1010265/where-should-myvalidatepasswordconfirmation-put-in-zend-framework

Billy