I worked with both new Propel and Doctrine2. What DataMapper (and I mean Doctrine2) does great is that your domain objects are clean and simple, they don't extend irrelevant classes that add a few unnecessary methods to you (violating SRP, as you said). These are simple objects with several properties and several methods that are part of your business layer. And this, of course, allows you to write unit tests for them and reuse them in the future.
I would not say DataMapper is much more complicated. This is difficult if you write your own implementation of DataMapper, but Doctrine2 is easier to use than propel (perhaps, with the exception of customization, we only do this once in any case). It has an entity manager that manipulates any entities. You may have object repositories for complex queries. And so it is.
And the object is as simple as:
class Question { private $title; public function getTitle() { return $this->title; } public function setTitle($title) { $this->title = $title; } }
In Propel, we will have 6 classes for this object, which will contain a lot of generated and often unused code.
What makes DataMapper more flexible? The simplicity that it provides.
meze
source share