updateAll with addInCondition

Hi all

I try to update multiple rows with the MySQL "IN" command.

My Code:




$criteria = new CDbCriteria;

$criteria->addInCondition ( "wall_id" , $wall_ids ) ; // $wall_ids = array ( 1, 2, 3, 4 );

Wall::model()->updateAll($criteria, 'read=1');



I get a CDbException with this message: No columns are being updated for table "wall_tweet".

Why do I get this Exception? The rows exists have to be updated.

Thank you very much!

1st parameter must be the attributes, 2nd the criteria, so it will be something like




$criteria = new CDbCriteria;

$criteria->addInCondition( "wall_id" , $wall_ids ) ; // $wall_ids = array ( 1, 2, 3, 4 );

$criteria->addCondition('read=1');

Wall::model()->updateAll(array('attr1'=>'val1','attr2'=>'val2'), $criteria);

altho, addInCondition is a condition statement, therefore it will be used to select which rows will be update with $attributes

Oh, that’s very nice. Thank you so much!