Beyond Activerecord - Where Do I Go?
Posted 24 April 2013 - 06:15 AM
Is there a best practice in Yii for how you organise your database interaction when "standard" AR fails you? I've read about behaviours, single table inheritance and overriding the instantiate method. I've not had that "aha" moment where I was looking at an obviously good solution to this issue. One option I have considered is using RedbeanPHP but that would be a pretty big step away from Yii.
Do I introduce a data mapper class to convert my PHP classes into entities I can store? What do I do?
If you could point me one direction or another I'll do my best to go there.
Thanks for your help.
Posted 24 April 2013 - 06:22 AM
I think that Yii ActiveRecord models are pretty powerful, and behaviors are a nice way to add common functionality to them without duplicate code (among other benefits).
What kind of features you need in your application?
Posted 24 April 2013 - 08:12 AM
As soon as my model doesn't easily map to a single table, I get lost. For example when I have inheritance, i.e. a structure like this (I'm still trying to figure out exactly how I want to break the classes down but this would make sense to me to begin with)
http://abload.de/ima...04-24ac7jnc.png (can't seem to insert the png file, sorry I'm at work...)