Re: find() when having nested models

2009-10-01 Thread Melanie Sommer
Hello Brian, thank you for the information about containable. It works fine, except for one problem. I use this code: $this-E-find( 'all', array( 'contain' = array( 'D' = array( 'fields' = array('D.title'),

Re: find() when having nested models

2009-10-01 Thread John Andersen
I think I read somewhere (here in the group) that you need to include the foreign keys in the fields definition, so containable can see them! Enjoy, John On Oct 1, 1:51 pm, Melanie Sommer melanie-som...@mailinator.com wrote: Hello Brian, thank you for the information about containable. It

Re: find() when having nested models

2009-10-01 Thread Melanie Sommer
Hi John, I think I read somewhere (here in the group) that you need to include the foreign keys in the fields definition, so containable can see them! I read contain automatically also includes the foreign keys in it's sql-query. http://book.cakephp.org/view/474/Containable : As you can see,

Re: find() when having nested models

2009-10-01 Thread John Andersen
Yes, I read that too, and later in the text is this note: When using 'fields' and 'contain' options - be careful to include all foreign keys that your query directly or indirectly requires. And to me it looks like you should ensure that you specify the primary keys (id) and the foreign keys

Re: find() when having nested models

2009-10-01 Thread Melanie Sommer
Hello John, I already tried putting all X.id and X.Y_id in the respective field arrays - no change. And this also does not explain, why cakephp does the right thing automatically when I select B, C, D, F, and G, but not when selecting A. What I do not understand is the difference between the

Re: find() when having nested models

2009-10-01 Thread Melanie Sommer
Problem solved. There was a typing error in the C model. Sorry! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this

Re: find() when having nested models

2009-10-01 Thread John Andersen
No problem :) On Oct 1, 6:00 pm, Melanie Sommer melanie-som...@mailinator.com wrote: Problem solved. There was a typing error in the C model. Sorry! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To

find() when having nested models

2009-09-29 Thread Melanie Sommer
Hi, I have models with belongsTo and hasMany relations in the following form: A - C - D - E B - C F - E G - E When displaying E I also want to display the title-fields of A, B, C, D, F and G. find() can only be set to rescursive=2 giving me E together with D, C, F, G. What is the best way of

Re: find() when having nested models

2009-09-29 Thread brian
Use ContainableBehavior and try the find() like: $this-E-find( 'all', array( 'contain' = array( 'D' = array( 'fields' = array('D.title'), 'C' = array(