Quote Originally Posted by oddz View Post
So in the below case given a collection of 1000 blogs one query will be executed upon saving the status change rather then 1000.

PHP Code:
$blogs Blog::find(array('user_id'=>2));
foreach(
$blogs as $blog$blog['status']= 0;
$blogs->save(); // one query 
Collections of records can be saved and deleted as easily as it is to do so with a single record. The queries are always optimized to least amount of possible based on the single save regardless of the number of objects or depth of those objects (relational hierarchy). While it is a considerable amount of code there isn't any noticeable drop in performance. I'm sure though this would change given perhaps a huge number of objects with a very complex individual hierarchy of related objects. However, its only as complex and involved as the developer makes it.
Is that one query
Code:
UPDATE blogs SET status = 0 WHERE user_id = 2
?
Because that would be quite cool.