A
A
Alexey Zaitsev2019-12-22 11:51:59
PHP
Alexey Zaitsev, 2019-12-22 11:51:59

Where to download intermediate data?

Let's say there is an entity "record", "comments", "user", all these are separate classes.
In the application, let's say the 'post' model will load a collection of 'post' objects with the number of comments.
And all this will be displayed on the page.
But what if you want the entries that the user has already viewed or bookmarked to be marked?
All my decisions lead either to links between two models, or to the removal of logic in the controller.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roll Back, 2019-12-22
@lesha73_rw

Share not models, but bounded contexts.
Post, comments and user are one bounded context.
This idea is sanctified in Vernon's book - "Implementing Domain-Oriented Design Methods".

A
Andrey, 2019-12-22
@VladimirAndreev

What's wrong with model relationships?
And it is better to take out the logic with the data in the service.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question