Cfiltervalidator Fires Twice (During Validation And Save)

Hello! I’m trying to use my own filter in model. Here is a validation rule:




    array(

        'about',

        'filter',

        'filter' => array(

            'MyFilter', 

            'filterText'

        ),

        'on' => 'profile'

    ),



MyFilter is a class name, filterText is a filter method. This method clean up text (using CHtmlPurifier) and wrap it in "p" tags (by new lines \n).

The problem is that text is became filtered twice: first when validate method is fired and second when save method is fired. So I get something like this:

<p><p>1</p></p>

<p><p>2</p></p>

<p><p>3</p></p>

<p><p>4</p></p>

<p></p>

Instead of this:

<p>1</p>

<p>2</p>

<p>3</p>

<p>4</p>

Maybe there are ways to disable filter at save method?

If the model is already validated that there is no need to validate it again on save so use save(‘false’) - http://www.yiiframework.com/doc/api/1.1/CActiveRecord#save-detail

Thank you! It solved the problem.