Not wrong, but it makes money an entity rather than a value object.Originally Posted by nacho
| SitePoint Sponsor |
Not wrong, but it makes money an entity rather than a value object.Originally Posted by nacho
Jason Sweat ZCE - jsweat_php@yahoo.com
Book: PHP Patterns
Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
Detestable (adjective): software that isn't testable.


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





Hi...
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.
yours, Marcus
Marcus Baker
Testing: SimpleTest, Cgreen, Fakemail
Other: Phemto dependency injector
Books: PHP in Action, 97 things




Off Topic:
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.
Bookmarks