Get all associate/composite objects inside an object (in Abstract way)

前端 未结 4 739
情书的邮戳
情书的邮戳 2020-11-29 11:45

Business:

I have a payment system in which payment can be made though GiftCoupon, ClubMembershipCard etc. One payment itself can have multiple paym

4条回答
  •  眼角桃花
    2020-11-29 12:19

    I think you might want to step back from the design for a moment. What I've heard is this:

    A payment consists of one or more components, and each component can be one of a variety of types

    What it sounds like you need is a Payment table, then a PaymentComponent table with a foreign key relation back to the Payment table. You can then implement inheritance on the PaymentComponent table for your various forms of payment.

提交回复
热议问题