In the documentation it shows an example of one record being updated.
It is possible to update multiple records from an ORM query?
Essentially what I'm trying to do is read x amount of records from the DB and them mark them as processed.
Just wondered if there was a quick ORM method, or whether I had to use the standard DB class?
No, there isn't.
An ORM works with objects, where every object represents a row in a database table. This implies you will have to iterate over the objects retrieved in a query, and save them one at the time.
The ORM does update related records on a save() if you have enabled cascading saves. So if the objects in question have a common parent, you can fetch the parent, all it's children, update the child objects, and save the parent. That will automatically also update all children.
It will still do it one at the time though, the first rule still applies.
If you're looking for an "UPDATE this WHERE that", use the DB class. It's perfectly fine to use that in an ORM model method, the ORM itself also utilizes the DB class to run it's queries.
had the same problem and found this clear answer :) however i still think it would be better if i can just write Model_xyz::find()->where(...)->update(...);
and in the underneath it generates the update query and run it once instead of looping not sure if this is possible though :)