I don't know if this can be done with HABTM (doubt it as HABTM is an automagic feature meant to join two tables only) but I for one would modelise the join and have something like:
Staff hasMany PositionSchoolStaff School hasMany PositionSchoolStaff Position hasMany PositionSchoolStaff PositionSchoolStaff belongsTo Staff, School, Position This way you can do a heck of a lot more in a more understandable way with your join table and add extra fields such as starts and ends to give more detail about the position held. HTH, Paul On Oct 27, 4:35 pm, Richard Neil Roque <[email protected]> wrote: > Ah. sorry, i didn't post my question. > > I would like to ask on how would i implement HABTM relationship in the > four tables? > > Looking like > > Staffs > School #1 - Science Teacher 1 > School #1 - Science Teacger 2 > School #2 - Physic Professor > > Thanks > > On Oct 27, 1:53 pm, Richard Neil Roque <[email protected]> > wrote: > > > > > > > > > My program is consist of > > > tables: > > staff > > schools > > positions > > positions_schools_staffs > > > 1 staff can be in in different school > > 1 staff can have different position in every school. > > > I do it using HABTM to hospital, > > > So one staff can have many hospital > > But i dont know how to retrieve the positions. > > > positions_schools_staffs structure: > > > id int > > staff_id int > > school_id int > > position_id int > > created date > > modified date > > > Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
