Remove old list for person document

This commit is contained in:
2023-05-30 21:24:22 +02:00
parent 40af1e64ac
commit e9fdabf931
7 changed files with 9 additions and 128 deletions

View File

@@ -45,10 +45,6 @@ class DocumentPersonController extends AbstractController
protected TranslatorInterface $translator;
private PaginatorFactory $paginatorFactory;
private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository;
/**
* DocumentPersonController constructor.
*/
@@ -56,14 +52,10 @@ class DocumentPersonController extends AbstractController
TranslatorInterface $translator,
EventDispatcherInterface $eventDispatcher,
AuthorizationHelper $authorizationHelper,
PaginatorFactory $paginatorFactory,
PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository
) {
$this->translator = $translator;
$this->eventDispatcher = $eventDispatcher;
$this->authorizationHelper = $authorizationHelper;
$this->paginatorFactory = $paginatorFactory;
$this->personDocumentACLAwareRepository = $personDocumentACLAwareRepository;
}
/**
@@ -88,7 +80,7 @@ class DocumentPersonController extends AbstractController
return $this->redirect($request->query->get('returnPath'));
}
return $this->redirectToRoute('person_document_index', ['person' => $person->getId()]);
return $this->redirectToRoute('chill_docstore_generic-doc_by-person_index', ['id' => $person->getId()]);
}
return $this->render(
@@ -160,45 +152,6 @@ class DocumentPersonController extends AbstractController
);
}
/**
* @Route("/", name="person_document_index", methods="GET")
*/
public function index(Person $person): Response
{
$em = $this->getDoctrine()->getManager();
if (null === $person) {
throw $this->createNotFoundException('Person not found');
}
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
$total = $this->personDocumentACLAwareRepository->countByPerson($person);
$pagination = $this->paginatorFactory->create($total);
$documents = $this->personDocumentACLAwareRepository->findByPerson(
$person,
['date' => 'DESC', 'id' => 'DESC'],
$pagination->getItemsPerPage(),
$pagination->getCurrentPageFirstItemNumber()
);
$event = new PrivacyEvent($person, [
'element_class' => PersonDocument::class,
'action' => 'index',
]);
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
return $this->render(
'ChillDocStoreBundle:PersonDocument:index.html.twig',
[
'documents' => $documents,
'person' => $person,
'pagination' => $pagination,
]
);
}
/**
* @Route("/new", name="person_document_new", methods="GET|POST")
*/
@@ -233,7 +186,7 @@ class DocumentPersonController extends AbstractController
$this->addFlash('success', $this->translator->trans('The document is successfully registered'));
return $this->redirectToRoute('person_document_index', ['person' => $person->getId()]);
return $this->redirectToRoute('chill_docstore_generic-doc_by-person_index', ['id' => $person->getId()]);
}
if ($form->isSubmitted() && !$form->isValid()) {