Hi,
> Thank you for your help.
> If I use Containable ("POINT 1") I get the results I want but it takes
> too many seconds (about 11 seconds).
Hmm, that's a long time. What are the SQL queries that are being run?
I think it would be prudent to paginate your data, rather than get
1000s in one hit.
Try:
// Attach Containable if not already attached
$this->Client->Behaviors->attach('Containable');
// Set contain params for Client model
$this->Client->contain(array(
'Report'=>array('limit'=>1)
));
// Grab data via the paginate method
$this->data = $this->paginate('Client');
// Loop over in view
foreach($this->data as $row):
echo 'name: '.$row['Client']['name'];
if (isset($row['Report'][0])):
echo 'last report created: '.$row['Report'][0]['created'];
endif;
endforeach;
--
jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---