Hi,
I have a special custom validator (without class, only function) in model and I want to mark an attribute as unsafe. I tried with below code but the unsafe validator does not mark it as unsafe. with scenarios works properly (and may should follow this approach) but I have already wrote a lot of code and adding scenarios for each line may make my website unstable…
public function myCustomValidatorCondition($attribute, $params) {
if (...some condition...) {
$valid = CValidator::createValidator( 'boolean', $this, array($attribute));
$valid->validate($this);
} else {
$valid = CValidator::createValidator( 'unsafe', $this, array($attribute));
$valid->validate($this);
}
}
I also noted that each validator has $safe variable to mark (?) the attribute as unsafe. how can I use this for τhe above purpose?