Richard Knop
Richard Knop

Reputation: 83755

How can I add custom path for validators?

Zend Framework defaultly looks for validators only in this path:

Zend_Validate_: Zend/Validate/

How can I make it look also in, for example:

My_Validator_: My/Validator/

I can't find anything about this problem in the documentation.

Upvotes: 0

Views: 204

Answers (1)

David Weinraub
David Weinraub

Reputation: 14184

Should be

$element->addPrefixPath('My_Validator_', 'My/Validator', 'VALIDATE');

To do it at the form level, it should be:

$form->addElementPrefixPath('My_Validator_', 'My/Validator', 'VALIDATE');

Upvotes: 5

Related Questions