Answer the question
In order to leave comments, you need to log in
How to properly implement CRUD when working with DDD and Yii2?
How to properly implement CRUD? Everywhere in the examples there is only a description of how to save data, I would like to see an example of reverse interaction.
Real situation:
The data warehouse is 1C SOAP, and the data is in a terrible structure and in a form that is inconvenient for the current project, but nothing can be done about it now. To interact with 1C, a SoapService layer was written that takes an object with request parameters as input and returns an object with a parsed response.
It is more convenient for me to use Yii2 models (forms) in the controller, because I do not want to lose the possibility of client validation and other things, but if we proceed from the logic, then these forms are nothing more than DTOs.
Actually the question is:
1. Is it normal that the answer from 1C will give me not an Entity in the form as it is understood in DDD, but a DTO?
2. Why do I need an Entity as a whole, if I can take data immediately from the DTO (form) and transfer it to the storage work layer?
Answer the question
In order to leave comments, you need to log in
Denaming an array
php.net/manual/en/language.types.array.php
Example #7
1. DDD means subject development. Accordingly, CRUD is not quite right to do here. Here you need to work with UseCase: create a product, delete the product, pay for the product, archive the product. This is more than CRUD.
2. In the framework, make your own core that accepts DTOs. Push the data into the DTO, then transfer it to the service, process the data and push it through the Repository into the database. In principle, everything is simple. You can see Dmitry Eliseev's course on working with an online store. If we talk about examples, then here , the truth is on the symphony.
There is also an example from the store itself
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question