Saving a model with a CHtmlPurifier validation rule from a ConsoleCommand


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');