Yii Framework Forum: Saving a model with a CHtmlPurifier validation rule from a ConsoleCommand - Yii Framework Forum

Jump to content

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

Saving a model with a CHtmlPurifier validation rule from a ConsoleCommand Rate Topic: -----

#1 User is offline   erma87 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 25-October 11

Posted 25 October 2011 - 04:11 PM

Hi,

I have a model, MyModel, where I use CHtmlPurifier to filter a few attributes. The problem I run into is when trying to save an instance of MyModel in a console command, since CHtmlPurifier is a Widget, and CConsoleApplication doesn't have a "getController" method. Any suggestions on what to do?

My rules look something like this:

class MyModel extends CActiveRecord {
public function rules() {
return array(
array('description', 'filter', 'filter' => array(new CHtmlPurifier(), 'purify');
);
}
}

Thanks!
Eric
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