Where can I find some basic examples of these two design patterns?Datamapper / Domain Object
I want to avoid ActiveRecord but am having a hard time differentiating it from Domain Object.
Some examples or skeleton/outlines of the classes would help.
I take it you've read the Martin Fowler book (Patterns of Enterprise Application Architecture)?
PHP Objects, Patterns and Practice:http://apress.com/book/view/9781430229254
Data Access Patterns: Database Interactions in Object-Oriented Applications
Active Record is a way to create an object oriented domain model. Data mapper is another way.
in a nutshell
Active Record represents a one to one relationship between an object and a table on a database,
Data Mapper on the other hand can map several tables to one object (and back again).
I'm pretty sure you mean it that way but that should rather be:
"ActiveRecord is a way to persist an object oriented domain model. Data mapper is another way."
I think the difference is crucial
Sort of. What I meant was that it's a particular way of implementing it. The problem with AR is that it couples persistence and domain model to each other.