Save multiple registers in one query with CActiveRecord

Hello all,

I would like to update various registers from a DB in only one query, the value of the field to update is not fixed so I cannot use updateAll (at least I think so). Is there some way to save an array of models (The same class model) in only one query?

I want to apply this in the case where I have a table representing an ordered list (id, name and position), the user can sort it with the JUiSortable widgrt, and I receive an array with the id’s ordered by the user. I find the record with an in condition, and after that I change the postion field according to the list received. Now each time I change a register I save it (so I make one query each). I would like to save all the records in only one query after update all the registers. I think is better for the DB performance and I avoid unexpected errors saving registers.

Thank you very much.


Any idea??