开发者

Database design question, using inheritance

I'm using Symfony2 and Doctrine2 to create a blog engine. I will have three types of contents, so I created this, using inheritance :

Database design question, using inheritance

Next, I want to have "blocks" of text that can be inserted after any "content", so I do :

Database design question, using inheritance

Now my problem is : How can I store the information that some blocks should be included by default with certain types of contents ?

开发者_JAVA百科

Example : say I have a "social" block (includes the facebook button, a tweet button, etc.). I want it to be linked by default in any new "blog" content.


If the default block, like "facebook" button, won't be different between different contents. You may consider generating block from the code instead of database for better performance.

Otherwise, if users could customize these buttons after new content is inserted, you just insert "default block" after insert a new content in code. The relational data model can't help if the default data is complicated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜