S
S
Sergey Ilichev2021-03-09 11:59:56
Software design
Sergey Ilichev, 2021-03-09 11:59:56

DDD in general and in particular if the cost is based on yii2?

Hello everyone!)

There is a question about DDD.

I began to study this architecture, read articles, watched videos, in general, rummaged through a lot of material on this topic. I myself now write most of all on the Yii2 framework.

Here we have a model. In yii2 it is ActiveRecord (most often), what is it from DDD world? Is it entity? Or otherwise, what is entity in Yii2 concept? AR contains a description of the model fields and seems to be the most suitable for this role, but at the same time, it doesn’t even satisfy the single responsibility concept at all and contains different logic that is not inherent in an entity.

Is AR even necessary in DDD? How to use it? Like some service? Or not use at all? And the same communications where to store then?

Maybe it's possible to rewrite the model generator, so as to generate just models with a set of fields, without reference to AR, and to access the type base, use not AR, but simply a query builder?

Maybe someone saw a Yii2 project with a deployed DDD, that is, with a ready-made architecture, generators? I would like to see the architecture and understand how it should look like in general. Some generally write that logic should be kept in services, although in most of the articles that I read and in the videos that I watched, they say that only logic that is not suitable for any entity should be kept in services.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anvar Shakhmaev, 2021-03-09
@RxR

There are many implementations, all of them are different. Evans' book can be considered a standard. Instead of services, you can use CQRS, which directly interact with repositories. I have the logic that cannot be implemented in the root entity of the aggregate is placed in the repository, but this solution is obvious.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question