Wednesday, September 7, 2011

find('first') - How to limit contained tables results

Hi there,

I have a Problem with limiting the Output of my find.
I have a table of trees and a table of apples. Apples belong to trees.
My view was outmatically generated by CakePHP showing me the Tree details
and a table of all apples belonging to my tree under it.
The Find Command in the Controller is


$result = $this->Tree->find( 'first',
array(
"contain" => array(
"Apple",
),
)
);

My Problem comes as soon as I view my biggest tree with 1.000.000 Apples.
How can I limit the amount of apples through the Query?
Tried using limit => 1 which does not work, since the find('first') does a
limit 1 for the tree anyway but not for my apples...

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: