Hello to all, just started to play around with cake and I like it. Now I stuck a little concernig accociations and the recursive level of find/findAll.
I got following setup: Product hasMany Comment Comment belongsTo User Comment belongsTo Product User hasMany Comment Within the product view I would like to show all comments belonging to this product including the nickname of the user who wrote it. With a normal > $this->Product->read(null, $id)); I only can get the User.id of the comment Table. Ok, I can set > $this->Product->recursive = 2; to fetch the belonging user, but then there's a big sql query overhead because cake also fetches the belonging product of the comment again, which obviously is not needed. to make it hopefully a bit more clear, here's my data array (shortened): Array ( [Product] => Array ( [id] => 3 [name] => Handy aus Ttitan mit Diamanten [description] => Sehr teuer, sehr cool ;-) [selldate] => 2008-01-22 17:09:00 [price] => 8887.23 [condition] => NEW [created] => 2008-01-22 17:10:10 [slug] => Handy-Aus-Titan-Mit-Diamanten ) [Comment] => Array ( [0] => Array ( [id] => 2 [user_id] => 1 [product_id] => 3 [text] => sdfsfsdfsdfsd [created] => 2008-01-23 17:38:18 [User] => Array ( [fname] => Sven [username] => zoq [email] => [EMAIL PROTECTED] ) [Product] => Array ( [id] => 3 [name] => Handy aus Ttitan mit Diamanten [description] => Sehr teuer, sehr cool ;-) [selldate] => 2008-01-22 17:09:00 [price] => 8887.23 [condition] => NEW [created] => 2008-01-22 17:10:10 [slug] => Handy-Aus-Titan-Mit-Diamanten ) ) ) ) Is there any way to avoid $recursive = 2 ? Or is it just the way cake works ? Or should I manually get the comments username byId which in fact would safe some queries ? If so, how can I get the required user names ? I would like to hear what, in such a situation, would be the best to do. thx --B. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---