I have a complex joining like
A belongs to Many B threw AB table AB belongs to many C threw ABC table
Now my problem is how i can get data in controller A which contain result till table ABC. Not finding direct relation in A and table ABC
My database structure is
Table A (id, name, code) Table B (id, name, code) Table C (id, name, code) Table AB (id, a_id, b_id, fee) Table ABC (ab_id, c_id, opt_date, tno)
I can connect with B using below query but not sure how to get data for ABC
$this->A->find('list',[
contain => ['B']
]);
Here i am changing it to my real scheme
1. courses (id, name, course_code, etc...)
2. sessions (id, name, status, start_date, end_date)
3. seats (id, name, description, metadata, status)
4. courses_sessions (id, course_id, session_id, programme_coordinator, academic_coordinator, status)
5. courses_sessions_seats (id, courses_session_id, seats_id, no_seats)
Current Relations
a) courses belongsToMany sessions using courses_sessions
b) courses_sessions belongsToMany seats using courses_sessions_seats
I don't know if case two is possible on not, but what i want is to show course details with available seats per category session wise.