personDocumentRepository->find($genericDocDTO->identifiers['id'])?->getObject(); } public function supportsGenericDoc(GenericDocDTO $genericDocDTO): bool { return $this->supportsKeyAndIdentifiers($genericDocDTO->key, $genericDocDTO->identifiers); } public function supportsKeyAndIdentifiers(string $key, array $identifiers): bool { return self::KEY === $key && array_key_exists('id', $identifiers); } public function buildOneGenericDoc(string $key, array $identifiers): ?GenericDocDTO { if (null === $document = $this->personDocumentRepository->find($identifiers['id'])) { return null; } return new GenericDocDTO( self::KEY, $identifiers, \DateTimeImmutable::createFromInterface($document->getDate()), $document->getPerson() ); } public function buildFetchQueryForPerson( Person $person, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null, ): FetchQueryInterface { return $this->personDocumentACLAwareRepository->buildFetchQueryForPerson( $person, $startDate, $endDate, $content ); } public function isAllowedForPerson(Person $person): bool { return $this->security->isGranted(PersonDocumentVoter::SEE, $person); } public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface { return $this->personDocumentACLAwareRepository->buildFetchQueryForAccompanyingPeriod($accompanyingPeriod, $startDate, $endDate, $content); } public function isAllowedForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod): bool { // we assume that the user is allowed to see at least one person of the course // this will be double checked when running the query return true; } }