CHAPTER 13 ■ DATABASE PATTERNS
300
methods here, or you could build an observer relationship between the ObjectWatcher and your
createObject() methods. I’ll leave the details up to you. Just remember, it’s up to you to prevent clones
of your domain objects running amok in your system!
Consequences
The Domain Object Factory decouples database row data from object field data. You can perform any
number of adjustments within the createObject() method. This process is transparent to the client,
whose responsibility it is to provide the raw data.
By snapping this functionality away from the Mapper class, it becomes available to other
components. Here’s an altered Collection implementation, for example:
namespace woo\mapper;
// ...
abstract class ...