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:

  • 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?

  • 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 to the Data Mapper pattern so am looking for a 'sanity check'.


    观看此演示文稿,您将了解如何使用服务和数据映射器。

    链接地址: http://www.djcxy.com/p/56286.html

    上一篇: 数据映射器和zend框架

    下一篇: Data Mapper可以调用另一个? 并继承?