overloading built-in validators

hi,

this may sound like a strange request but would it be possible to replace built-in validator classes, for example, by giving access to CValidator::builtInValidators array at initialisation time ? This way, it would be possible to replace :

'required'=>'CRequiredValidator'

by

'required'=>'CMyOwnRequiredValidator'

Why ? For instance, to add/modify validation methods without having to modify models rules. The CMyOwnRequiredValidator class could for instance not trim values to validate … or things like that.

In general, if I want to very slightly modify validation algorithm of a built-in validator, I could just write my own class derived from the Yii class, and tells Yii to use my class instead of the core one…

…or maybe there’s already a way to achieve this and I missed it ;)

8)

I think you can already do so by modifying CValidator::$builtInValidators.

ok … but tell me, you’re not saying that I should really modify CValidator.php right ? (or I should delete last sentence of my reply to this topic : http://www.yiiframew…html#msg6068).

…then, what would be the best way to modify CValidator::$builtInValidators ?

Thanks

8)

I mean an assignment statement, not modifying the CValidator.php file.

You can put this assignment statement anywhere (e.g. in your app config file).

All right Qiang, thanks for your help

8)