Hello! I have a bit complicated data structure in my project and I’m not sure what is the best approach to work with it in Yii application. I know it’s ambigious question, any thoughts would be appreciated.
I have several data types - article, photo post, audio, video and so on (like in Tumblr). Additionally, posts could be added to personal blog OR public community. Posts have some common fields (like title) and some unique, different for every data type. At the moment I have such schema:
And such models:
PublicPost extends Post
CommunityPost extends Post
Post model has relations for each data type. When working with post, for example in a view, i access common fields like $post->title and datatype-unique like $post->video->url.
Is there way to optimise this structure, make it more stable and convenient to use?