Yii Framework Forum: Validation rules() for non validating purpose - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Validation rules() for non validating purpose for data modification i.e. Rate Topic: -----

#1 User is offline   Karasko 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 89
  • Joined: 14-July 09
  • Location:Russia

Posted 28 February 2010 - 07:23 PM

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.
0

#2 User is offline   yiimann 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 102
  • Joined: 19-December 09

Posted 01 March 2010 - 11:21 AM

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

#3 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 01 March 2010 - 11:34 AM

View PostKarasko, on 28 February 2010 - 07:23 PM, said:

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


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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users