Validation rules() for non validating purpose

As i looked at Blog example again, i found this method


public function normalizeTags($attribute,$params)

{

    $this->tags=Tag::array2string(array_unique(Tag::string2array($this->tags)));

}

and referring to it in rules().

So is this normal to use rules() for non validation actions ? like preparing data and other.

Good question. would be great if anyone could answer that.

Define “normal”. ;)

At least it’s possible and can be very convenient in some situations. There’s even a validator for that, if all you want to do is to filter your attribute through a function: CFilterValidator.