From d6cc69b919a7157f50766327b501a65d4d4ca193 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 11 Feb 2022 11:25:53 +0100 Subject: [PATCH] Add pagination in the findBy() --- .../Controller/DocumentPersonController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php index 9dc9f7cf6..051584f3c 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php @@ -156,12 +156,15 @@ class DocumentPersonController extends AbstractController $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); - $documents = $this->personDocumentACLAwareRepository->findByPerson($person); - - // wrong: count documents in database and retrieve document for this page. $total = $this->personDocumentACLAwareRepository->countByPerson($person); $pagination = $this->paginatorFactory->create($total); + $documents = $this->personDocumentACLAwareRepository->findByPerson( + $person, + [], + $pagination->getItemsPerPage(), + $pagination->getCurrentPageFirstItemNumber()); + $event = new PrivacyEvent($person, [ 'element_class' => PersonDocument::class, 'action' => 'index',