CDbCriteria compare() with ListBox

In my gridview, I have a filter that uses






. When the CDbCriteria’s compare() runs with the ‘All’ selected in the view, the value is added in condition. I think in this case it should be ignored.

My humble solution to the problem:

public function compare($column, $value, $partialMatch=false, $operator='AND', $escape=true) {

        if (is_array($value)) {

            if (count($value) == 0 || $value[0] == '') {


                return $this;

            } else {

                return $this->addInCondition($column, $value, $operator);





What you guys think about it?