Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hi,

 

I was hoping someone might have some experience using model inheritance in Yii. So far, I've only seen single table inheritance solutions (a la http://www.yiiframework.com/forum/index.php/topic/12775-unified-relational-model-into-one/page__p__63052#entry63052 and http://www.yiiframework.com/forum/index.php/topic/12978-class-table-inheritance/page__p__135262#entry135262).

 

In practice, my requirements are only for a single level of inheritance. But in principle, the method prompts reservations. Before deciding on Yii as the framework, I spent a significant amount of time deciding on the database schema. One of my drafts included an arrangement that would support the single table inheritance solution with a 'type' attribute. However, I realized the 'correct' approach would be to just use JOINs, joining a table of an inheriting table to the table of a parent class (e.g. join the 'student' and 'parent' tables with the 'user' table on a primary/foreign key relationship). Most bothersome of the single table inheritance solution is the extraneous 'type' key which is not only unnecessary but also limiting to...single table inheritance.

 

Is the concensus that the solution I'm looking for just not possible with Yii and I have to accept single table inheritance as the best answer? Can anyone share their experiences that will prove me wrong? Let me know if I can be any clearer or provide more examples. Any help is appreciated.

 

Thanks,

Michael

Share this post


Link to post
Share on other sites

I can't imagine that using inherited tables in Yii would be impossible, but rather than deal with abstracts, how about sharing the specific application and needs. Or at least as many details as would be required to provide an educated answer.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...