Hopefully I'm missing something but when applying clean architecture in the real world (in web projects) it often occures to me that the majority of my UseCases are based on the display of data (query only).
A typical Interactor looks something like this (php in this example):
public function execute(SomeInteractorRequest $request)
{
$someEntities = $this->repository->find($request->getFilter());
$responseModel = $this->someEntitiesToSomeResponseModel($someEntities);
return $this->presenter->present($responseModel);
}
Initially, I thought that the main purpose of interactors is to contain the (application dependent) business rules ... but there is no business rule in here.
The Interactor only calls a repository and transforms the entities to a response model (which I often do by calling some kind of entity -> array converter or entitiy->genericDto converter in favor of not repeating myself).
The real logik here may be the filtering of the entities. But there is no point in doing the filtering inside the interactor because noone would fetch the whole database to get a handfull of entites filtered out manually.
When you compare 20 of these interactors, they all look pretty much the same. So I'm producing a bunch of interfaces and extremely boring to test interactors with an increasing feeling that interactors are completely useless for queries.
Now imagine the controller would call the repositories directly (through their interfaces of course). When changing the delivery mechanism, it's the same effort to call the interactor as it is to call the repository. And we dont't have to create an endless list of equal interactors.
So my questions are:
1.) Should my interactors contain more logic than they do now?
2.) Is there a better way to do query-only-requests in clean arch then with a bunch of these (nearly) empty interactors?
3.) How would my architecture be harmed if I would skip these interactors and directly call the repositories from the controllers?