CActiveRecord with multiple conditions - how?

I know this is a simple task but I cannot find the answer in the Yii docs example. How do you create a multiple condition query using AR? An SQL equivalent would be…

SELECT * FROM table_name WHERE foo = 1 OR bar = 2

$criteria = new CDbCriteria;

$criteria->condition = 'foo = 1 OR bar = 2';

$models = TableName::model()->findAll($criteria);

Thank you!

You can use compare() method from CDbCriteria. This is implementet in 1.1.1 version.

hello qwerty

how can i use compare() for this?

You can use by this:

$criteria=new CDbCriteria;

$criteria->compare("foo", "someValue", true, "OR");

$criteria->compare("bar", "someValue", true, "OR");