I think you are going to need some join tables here.
Maybe someone has a better solution?
On 6/8/06,
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I have an interesting situation:
I have a Model Appointment as follows:
id
client_id
counselor_id
start_time
end_time
I have a Model Client as follows
id
firstname
lastname
I have a Model Counselor as follows:
id
firstname
lastname
I want to do a Appointment->findById() and get all the associated data,
but you will notice that the simple hasOne doesn't work.
How would I set up relationships to do this? I tried
var $hasOne = array('Client' =>
array('className' => 'Client',
'conditions' => '',
'order' => '',
'dependent' => true,
'foreignKey' => 'client_id'
),
'Counselor' =>
array('className' => 'Counselor',
'conditions' => '',
'order' => '',
'dependent' => true,
'foreignKey' => 'counselor_id'
)
);
but that tries to join Client.client_id = Appointment.id
It seems this is sort of a "reverse has one" type of setting, if that
makes sense, but I can't wrap my head around how to do this.
Brian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- Re: reverse of hasOne John Zimmerman [gmail]
- Re: reverse of hasOne Olivier Percebois-Garve
- Re: reverse of hasOne [EMAIL PROTECTED]
