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 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.
精彩评论