On Jan 7, 11:35 pm, Deane <[EMAIL PROTECTED]> wrote:
> Assume this scenario:
>
> I need to retrieve 20 records, and call a method on each of them. So
> I do my Find, and get back an array. I then spin this, and do this:
>
> $this->Widget->read(null, $id);
>
> What has just happened from a SQL perspective? 21 separate SQL
> executions? (One for the loop, and 20 to hydrate the resulting
> objects, one-by-one...)
Are you deliberately trying to be difficult ;).
$data = $this->Widget->find('all');
foreach ($data as $results) {
$this->Widget->create($result);
$this->Widget->stuff();
}
Total sql calls: 1
And that's unless you write stuff() to be able to batch process data.
I feel it's time you either showed a real example of what you /can't/
do, or at least try things the cake way.
AD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---