开发者

PHP ORM's, multiple tables and efficiency

Let's say I have a data mapper function开发者_如何学Go that aggregates multiple tables and generates an object instance from that data. The mapper has a typical save() method which delegates to update/insert.

When the mapper executes save - ideally it isolates object fields that have been modified, thus preventing the code from blanket bombing the database.

How would you go about this?


Store both the original and a working copy of the data in the object(s). If they differ, write them back.

While you could store just a hash of the original data, this gets messy if your underlying database is normalized and you allow changes to the primary key.

C.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜