Not wrong, but it makes money an entity rather than a value object.Originally Posted by nacho
Yes, it does. I guess I could live with it though.
There’s more than one way to skin a cat.
I would definitely go the way defining schema in PHP (lastcrafts aproach) or XML. You can add this MySQL5 specific stuff anytime.Originally Posted by thr
Annotations support for PHP5
TC/OPT™ Group Leader
In the context of persistence it will drive you mad.Originally Posted by nacho
Regarding Money being made up of the amount and the currency, Postgres has a composite type facility. I think other database systems (not MySQL) have similar facilities.
Going the XML route will solve this problem quite easily. I managed to get "Changes" to return objects of arbitrary classes, and it's espcially easy if you are using serialisation.
Associating quantity and units is a more general domain pattern. For example, in continuous process manufacturing, one cannot express quantity without units. You can order 7 tractors, but you cannot order 7 molasses. In some industries the potential for rounding errors means that you always have to associate quantity and units. In my old industry, one could never leave behind the units expressed on the order, say by converting to a common unit. The resulting rounding errors could (and historically had) result in product that exceeded the capacity of its container.