Very interested in this setup too. We have a fairly complex project (70 
entities, use of STI, code generation), but unfortunately it's closed source, 
so I can't share the actual code.

If you don't already have it, the DDD book by Eric Evans is very good.

ORM Designer has been an indispensable tool.

We define a custom Repository for every Entity which extends 
\Doctrine\ORM\EntityRepository. This allows us to always use the Entity plus 
Repository as our base model (we can add Service classes for higher level 
domain model rules which need to combine Repositories). So our Repositories are 
the only place we allow DQL, and in the event that we have to optimize 
something more than we could with DQL, we can hide that alternate 
implementation inside the Repository method(s) so that it stays totally 
encapsulated. This strategy also allows us to add data-driven restrictions, 
such as additional query constraints for certain roles. For example, perhaps 
user role may only view records they own. By overriding the default find, 
findBy, etc on the Repository, it is trivial to simply add the additional query 
constraint to the native methods, and support this domain.

FWIW, we started out with separate Model classes, but found they always were 
reimplementing Repository methods, but with more boilerplate.

In any case, we're very interested in this combination, and are eager to learn 
more as well.

Jeremiah

On May 17, 2013, at 1:47 AM, "Christian Ebert" <ebert.ch...@gmail.com> wrote:

> I am looking for "best practice" real world applications or modules (open
> source) from which I can learn. I am specifically interested in applications
> with good performance which use ZF2 and Doctrine2 with a more complex domain
> model and ideally applying Domain-Driven Design principles.  I have already
> created applications with ZF2 and Doctrine2 but I am still struggling on how
> to "best" architect my applications regarding performance and on how to deal
> with associations in a more complex domain model especially when it comes to
> performance. I noted that top-down entity loading can quickly have a
> performance impact especially when business logic in an entity requires to
> load 1:n or m:n associations (multiplication of number of resultset rows and
> involved object hydration).
> 
> 
> 
> I would also appreciate recommendations for further expert reading. 

--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to