Re: Model Heirarchy and Quering

2007-05-23 Thread AD7six
On 23 mayo, 01:23, Brian Hartvigsen [EMAIL PROTECTED] wrote: I have 3 models, Group, User, Referral. Group hasMany User, User hasMany File. I have some Users that I want to be able to see all Files for other Users in their Group. Right now I'm trying to do this with $users =

Re: Model Heirarchy and Quering

2007-05-23 Thread Brian Hartvigsen
So it turns out I'm just making things harder than they need to be: $data = $this-File-findAll('User.group_id='.$this-Session- read('User.User.group_id')); I realize this only works because of recursion, but so far, it's the best solution I have, and I need the recursive data anyway to display

Model Heirarchy and Quering

2007-05-22 Thread Brian Hartvigsen
I have 3 models, Group, User, Referral. Group hasMany User, User hasMany File. I have some Users that I want to be able to see all Files for other Users in their Group. Right now I'm trying to do this with $users = $this-User-findAll('group_id = ' . $User['group_id']);

Re: Model Heirarchy and Quering

2007-05-22 Thread Langdon Stevenson
Hi Brian Have a look at the Conditions section of the Model page in the manual. It will give you a thorough explanation of how to construct the kind of complex conditions statement that you want (hint, this would use an SQL IN condition - which the manual covers). Given what you are trying

Re: Model Heirarchy and Quering

2007-05-22 Thread Joshua McFarren
Set $recursive = 2 in your Group model. See the manual. On May 22, 9:18 pm, Langdon Stevenson [EMAIL PROTECTED] wrote: Hi Brian Have a look at the Conditions section of the Model page in the manual. It will give you a thorough explanation of how to construct the kind of complex conditions

Re: Model Heirarchy and Quering

2007-05-22 Thread Brian Hartvigsen
I was trying to see if there was a way to do it within cake without a ton of iteration, but so far it appears that I'm going to have to do some data cleanup one way or another. $recursive = 2 would retrieve all the data, but wouldn't allow it to be sorted directly, I would have to go iterate

Re: Model Heirarchy and Quering

2007-05-22 Thread Langdon Stevenson
Hi Brian As mentioned, I don't know of a Cake way of doing it, but if you discover one then I am all ears :-) Regards, Langdon Brian Hartvigsen wrote: I was trying to see if there was a way to do it within cake without a ton of iteration, but so far it appears that I'm going to have to do