jonathangeiger / kohana-jelly

See the link below for the most up-to-date code
https://github.com/creatoro/jelly
MIT License
146 stars 34 forks source link

Support Polymorphic Models and Relationships #18

Open jonathangeiger opened 14 years ago

jonathangeiger commented 14 years ago

For this one, I really think we should go the STI route. If a User and a Group extends an Entity, the User and Group have no explicit table but all of there columns are munged into the entities table. We then have a type column that we read on each retrieval of the row.

It would, however, be rather easy to go the MTI route, because these are just Belongs_To relationships that can be automatically joined using a special form of with().

banks commented 14 years ago

Started work on this locally. MTI is a considerable problem to make work seamlessly due to aliasing, and joining issues. I will start by getting STI to work and seeing how much more functionality is likely to be useful without making the whole thing hideously complex.