N
N
nepster-web2017-09-14 18:36:22
PHP
nepster-web, 2017-09-14 18:36:22

Leakage or what dependencies can there be between layers in DDD?

I study DDD and undertook to refactor the architecture of the application using this approach.
There are 4 layers:
- Application
- Domain
- Infrastructure
- Presentation
The whole thing collects the Application Module using the LUMEN framework.
I have questions regarding the connectivity between the Application, Infrastructure and Presentation layers.
For example, we have a hydrator that can convert an entity to an array and vice versa. As I understood its place in Infrastructure. And I need this hydrator in Application and Presentation. And because of the data types, the hydrator is very highly specialized, so it doesn’t really need an interface.

class Hydrator {
    public function hydrate(array $data, string $className): object
    {
    }
    public function extract($entity): array
    {
    }
}

I have no choice but to directly pull the Infrastructure class in the Application and Presentation layers.
From here questions:
1. Can Application and Presentation layers depend on Infrastructure?
2. Whether there is a sense in the given situation to do the interface on Hydrator?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
egor_nullptr, 2017-09-14
@nepster-web

Presentaion > Application > Domain > Infrastructure
It's simple: from left to right you can call even with a layer skip, from right to left - no.
Answers:
1. They can.
2. If several implementations are meant, then yes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question