Welcome Guest, Not a member yet? Register   Sign In
Single Table Inheritance
#2

[eluser]sikkle[/eluser]
Model is just Model in ci, doesnt exist any kind of ORM at the moment.

hope this help.

good luck !
#3

[eluser]ricklee[/eluser]
oh yeah. i forgot Smile
#4

[eluser]sophistry[/eluser]
a quick look at the rails docs and examples tells me that this is not ORM - it is simply using one table to do the work of two or more tables. among other things, it's a way of handling heirarchical data (managers and employees are both people but using one table for them makes expressing their relationship hard - but you don't want two tables because that would mean redundant data, and you don't want to create a properly normalized set of tables because that's too much work ;-)

so, you come up with a shortcut. "single table inheritance" is one shortcut for organizing and giving the code framework access to a simple inheritance architecture in a database schema.

there have been multiple threads on this subject and related topics. use your keywords.

Thunder uk's Nested Sets is an option if you like the nested sets approach to organizing this type of data.

for general ORM there is the Rails Inspired: Rails style model interactions

there may be more... hope that helps inspire you to find/create more! this site is HUGE. - oh and the wiki.
#5

[eluser]ricklee[/eluser]
I did have ORM in mind actually when I was thinking about Single Table Inheritance (STI) in CI. What I want are difft models that subclass one parent model, but I want them all going to the same table.

In Rails, having the difft models means I can use difft validation filters, etc, while still mapping to the same table. Without using STI, they would have to go to difft tables.

I guess in CI (without ORM) it's not a big deal because you just make the database calls in each individual model and you can send the data wherever you want...
#6

[eluser]sophistry[/eluser]
why don't you subclass the model and override any methods in the base class that need to be different in the subclasses? it's hard to really understand what you want to do without specific examples, but perhaps using OOP will help you organize the approach?




Theme © iAndrew 2016 - Forum software by © MyBB