0

My goal is not to hack Yii in a totally different direction and it seems by following what I learned about inheritance and normalization that is not possible. On the image you can see what I would describe as an elegant solution for representing the structure in a DRY way. But Database Inheritance seems not like something which is usually done especially because no web framework seems to really support it.

Q&A db

MYSQL views are apparently not an option in Yii since the support is lousy (they want to keep everything db agnostic).

So is the only nice way to solve this to use Single Table Inheritance? If there is a web framework which has some great support for Multi Table Inheritance I would like to find out about it, but preferably I'm looking for a solution in Yii.

Gregor Weber
  • 690
  • 9
  • 24
  • I'd say it's rather [class table inheritance](http://martinfowler.com/eaaCatalog/classTableInheritance.html), not [single table inheritance](http://martinfowler.com/eaaCatalog/singleTableInheritance.html) what you're looking for. But you're right, there's not really a good solution for it in Yii. Maybe see the discussion [here](http://www.yiiframework.com/forum/index.php/topic/12978-class-table-inheritance/) or the summary [here](https://github.com/serebrov/notes/blob/master/yii/2012-02-01-yii-class-table-inheritance.md). – Michael Härtl Jul 09 '13 at 15:26
  • Sorry, after reading a second time i now see you asked, if single table inheritance is the only alternative. But anyway, maybe my links above give you some ideas. – Michael Härtl Jul 09 '13 at 15:27

1 Answers1

0

I created a multi table inheritance solution in Yii, but I think it's not yet mature.

Anyway, it's working for me. Check out my solution here:

http://co-tech.me/2013/08/18/yii-cactiverecord-multiple-table-model-inheritance/

Abed Hawa
  • 1,372
  • 7
  • 18