Domain-Driven Design in PHP
上QQ阅读APP看书,第一时间看更新

Collection Backed by a Database Entity

Database Entity is the same solution as Join Table, with the addition of the Value Object that's only managed by the owner Entity. In the current scenario, consider that the Money Value Object is only used by the HistoricalProduct Entity; a Join Table would be overly complex. So the same result could be achieved using a one-to-many database relation.

Exercise
Think of the mapping required between HistoricalProduct and Money if a Database Entity approach is used.