Let's say I have 3 models.
- Dentist (A user with with role='D')
- Applicant (More details on each user such as address, phone, interested_position, etc)
Position (In table applicants I only store position_id, this is where the description)
class Dentist extends AppModel { public $hasOne = 'Applicant'; }
class Applicant extends AppModel { public $belongsTo = array('Dentists', 'Position'); }
class Position extends AppModel { }
I have a problem in Dentists's view when I use $this->Dentist->find('all');
in my DentistsController because the SQL just like
select *
from dentists left outer join applicants
on dentists.id = applicants.dentist_id
No more like left outer join positions...
But if I use $this->Applicant->find('all');
in my ApplicantsController, I got left outer join positions...
How to set the model assosiation to get join statement to table "positions" from my DentistsController.
Thanks all.