Morning John, You need to set your recursive value to 2; either in your association model or specified in the findAll query your run to obtain the array of association models.
http://api.cakephp.org/classModel.html#63ade7d3c6d03c83ab53a224e23ad9dd One thing to be careful of here though, with recursive set to 2, you will often find Cake retrieves a great deal of records you may not need. i.e. it will query that second level of associated model indiscriminately as opposed to just grabbing the model you may want. Set recursive to 2, debug the returned array and then unbind any unrequired models. oth's unbindAll method is quite useful in these instances. You should come out with something that looks like: [Membership] => Array ( [0] => Array ( [id] => 1 [group_id] => 17 [member_id] => 15 [confirmed] => 1 [Member] => Array ( [id] => 1 [name] => Member name [etc] => etc ) ) ) Does this make sense? Cheers, Mike On 09/12/06, John <[EMAIL PROTECTED]> wrote: > > I am using a model for associations as outlined in: > http://www.thinkingphp.org/2006/10/26/modeling-relationships-in-cakephp-faking-rails-throughassociation/ > > Basically, I want to allow a user to have a "confirmed" status in a > group. > > Now, when an admin visits the group controller (in an action, of say, > "view", I want them to show a table of all the confirmed users, and the > unconfirmed users of a group (as well as the group information). > However, I only have access to their IDs, that is, when I run > debug($data['Group']; I get the group information, and: > > [Membership] => Array > ( > [0] => Array > ( > [id] => 1 > [group_id] => 17 > [member_id] => 15 > [confirmed] => 1 > ) > > [1] => Array > ( > [id] => 2 > [group_id] => 17 > [member_id] => 18 > [confirmed] => 1 > ) > > ) > > Now, I can show the ID's of the member, but I do not have access to > their name, location, etc. which I also want to display to the user in > this controller action. > > How do I access such data in the view? Or should I be doing something > extra in the controller? > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
