Criteria with boolean=true don't works

I have the next in my model->search():

$criteria->compare(‘someBooleanField’,true);

When I put to true (I want restrict the elements in the search with has the field to true), it works, but when I do the same changing to

$criteria->compare(‘aprobado’,false);

All elements in the bd, are retrieved.

Any Ideas?

Thank you!

Try:




$criteria->addColumnCondition(array(

    'someBooleanField' => false,

));



or:




$criteria->compare('someBooleanField', 0);



CDbCriteria::compare() converts the value to string, and returns without modifying the condition when string is empty. Boolean true is converted to string "1" so it works, but false is converted to empty string.

Ok, thanks a lot!