A
A
Alexander Evgenievich2016-03-30 13:30:03
PHP
Alexander Evgenievich, 2016-03-30 13:30:03

How to organize Lazy Load in DDD?

Hello.
How to properly organize LazyLoad in DDD. Is it correct to use the Rich Domain Model and push repositories into it?
There is just a misunderstanding. Because in many sources they write that the Domain Model should not know anything about the persistence layer. OK. And not have upstream dependencies (services, etc.). If you ask how to organize Lazy Load then, they answer:
Either use events, which is difficult to debug and still requires a dispatcher.
Or use direct calls to the repository for this. Then a reasonable question is, why are all these domain models, etc. if all the work will still be performed through services?
If I can't do $user->etProducts(); and should call the repository and access through it?
Why then fence gardens from mappers?
Besides at implementation of domain model it is necessary to create and IdentityMap? And as a result, an implementation over ORM is obtained, which really does not allow using the capabilities of ORM, because all connections are thrown through the settings in the DTO.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artur Nurullin, 2016-04-07
@Splo1ter

You won’t get a beautiful solution in php, or write some kind of proxy service through which collections will be unloaded regardless of type

A
Alexander Evseev, 2016-04-07
@alex1t

Just on topic, though only for .NET, but the meaning is the same:
enterprisecraftsmanship.com/2016/04/05/having-the-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question