Answer the question
In order to leave comments, you need to log in
Where to use paginator: in controller or repository?
Hello.
How would it be more correct to use the paginator:
1. In the controller, we access the repository, we get the Query object (or QueryBuilder). Further, right there, in the controller (well, or in the service it doesn’t matter), we create a paginator object (I use Pagerfanta), we pass the Query object to it.
2. Or in the repository immediately after creating the request, we create a paginator, and from the repository we already give the paginator, and not Query or QueryBuilder.
The Symfony demo always seems to use the second option, which is why I did the same. But many people use the first one. It seems to be more flexible.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question