Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About asiral

  • Rank
  1. 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
  • Create New...