--

Let's start with an example

* https://github.com/simara-svatopluk/cart

* Unit tested and Contract tested

Integration with Symfony DI is not a big deal, we register the interface implementation (autowired). The interface must be passed into the entity. The place where it's passed is UseCase/CommandHandler/Controller/... and in these classes the interface is passed by constructor. Ou that's difficult description, code will explain it better https://github.com/simara-svatopluk/cart/blob/master/src/Application/CartUseCase.php

> but it’s considered bad practice anywhere you read about services in domain entities.

What do You mean by this statement? And could You please provide an example who consider "it" as a bad practise?

--

--

Svaťa Šimara
Svaťa Šimara

Written by Svaťa Šimara

Developer interested in Domain-Driven Design & Modeling

Responses (1)