开发者

OK for Data Mapper to call another? And to inherit?

In my database I have a User table with many related entities including Pets, Cars, Houses. More often than not my application will be working with just the User, however sometimes it will need to work with its related entities as well.

I'm planning to use Data Mappers (and Table Data Gateways) in Zend Framework. A few questions:

  1. I think I'll have a BaseUser class, and an ExtendedUser class, with a Mapper for each. The ExtendedUser will inherit from the BaseUser, and the ExtendedUserMapper will inherit from the BaseUserMapper. Does this sound reasonable?

  2. When my ExtendedUserMapper is working with related entities (such as a Pet, or a Car), it would call methods on a PetMapper, CarMapper, etc. Does this sound reasonable?

I am new t开发者_开发问答o the Data Mapper pattern so am looking for a 'sanity check'.


Watch this presentation and you'll understand how to use services and data mappers.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜