当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Where to code the database management of some entities in oop environtment

问题描述:

Say i have some entity classes like:

avatar

category

set

well all of them have name and description so i inherit it from abstract class.

what i really want is, these classes need to be retreived from a database.

Where to code the querys?

a)

In external class, like "dbmanager" where you do something like dbmanager->sync(object_to_be_updated), then this class detects the class instance of object_to_be_updated, switch and does datbase stuff returning the updated object.

OR

b)

Having just a method on each avatar, category, set doing the properly stuff.

分享给朋友:
您可能感兴趣的文章:
随机阅读: