mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Pagination added
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\Controller;
|
||||
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||
use Chill\DocStoreBundle\Form\PersonDocumentType;
|
||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
@@ -35,20 +36,13 @@ use Symfony\Component\Translation\TranslatorInterface;
|
||||
*/
|
||||
class DocumentPersonController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @var AuthorizationHelper
|
||||
*/
|
||||
protected $authorizationHelper;
|
||||
protected AuthorizationHelper $authorizationHelper;
|
||||
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
protected EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
/**
|
||||
* DocumentPersonController constructor.
|
||||
@@ -56,11 +50,13 @@ class DocumentPersonController extends AbstractController
|
||||
public function __construct(
|
||||
TranslatorInterface $translator,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
AuthorizationHelper $authorizationHelper
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
PaginatorFactory $paginatorFactory
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,6 +166,9 @@ class DocumentPersonController extends AbstractController
|
||||
['date' => 'DESC']
|
||||
);
|
||||
|
||||
$total = count($documents);
|
||||
$pagination = $this->paginatorFactory->create($total);
|
||||
|
||||
$event = new PrivacyEvent($person, [
|
||||
'element_class' => PersonDocument::class,
|
||||
'action' => 'index',
|
||||
@@ -181,6 +180,7 @@ class DocumentPersonController extends AbstractController
|
||||
[
|
||||
'documents' => $documents,
|
||||
'person' => $person,
|
||||
'pagination' => $pagination
|
||||
]
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user