Welcome Guest, Not a member yet? Register   Sign In
DataMapper ORM advanced multi-table relationships
#1

[eluser]Shauna Gordon[/eluser]
I have three tables - doctor, patient, module.

Currently, module has a many-to-many relationship with the other two. This setup works fine.

However, I now need to have a three-table relationship between the them while still keeping the current relationships intact.

I have the following join table:

doctors_patients
- doctor_id
- patient_id
- module_id

Is there a way to set up DataMapper ORM to do both a three-table relationship like this? It is very important that the other relationships stay intact (as much as I'd love to change it, it has to stay intact for business reasons, not my call, unfortunately).

I'm open to both "automatic" methods with datamapper (establishing the relationships in the $has_many array), and extending the models with custom functions (which I've tried, to no avail, so if that's the only way, some guidance on how to go about that would be appreciated).

I'm using CI 1.7.2 and DM 1.8.1, and can't upgrade either.




Theme © iAndrew 2016 - Forum software by © MyBB