mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-25 09:03:48 +00:00
[generic doc] listing generic doc for person
This commit is contained in:
@@ -12,20 +12,25 @@ declare(strict_types=1);
|
||||
namespace Chill\DocStoreBundle\GenericDoc\Renderer;
|
||||
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocDTO;
|
||||
use Chill\DocStoreBundle\GenericDoc\Providers\PersonDocumentGenericDocProvider;
|
||||
use Chill\DocStoreBundle\GenericDoc\Twig\GenericDocRendererInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\Providers\AccompanyingProviderCourseDocumentGenericDoc;
|
||||
use Chill\DocStoreBundle\Repository\AccompanyingCourseDocumentRepository;
|
||||
use Chill\DocStoreBundle\Repository\PersonDocumentRepository;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
final readonly class AccompanyingCourseDocumentGenericDocRenderer implements GenericDocRendererInterface
|
||||
{
|
||||
public function __construct(
|
||||
private AccompanyingCourseDocumentRepository $accompanyingCourseDocumentRepository,
|
||||
private PersonDocumentRepository $personDocumentRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
|
||||
{
|
||||
return $genericDocDTO->key === AccompanyingProviderCourseDocumentGenericDoc::KEY;
|
||||
return $genericDocDTO->key === AccompanyingProviderCourseDocumentGenericDoc::KEY
|
||||
|| $genericDocDTO->key === PersonDocumentGenericDocProvider::KEY;
|
||||
}
|
||||
|
||||
public function getTemplate(GenericDocDTO $genericDocDTO, $options = []): string
|
||||
@@ -35,9 +40,18 @@ final readonly class AccompanyingCourseDocumentGenericDocRenderer implements Gen
|
||||
|
||||
public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array
|
||||
{
|
||||
if ($genericDocDTO->linked instanceof AccompanyingPeriod) {
|
||||
return [
|
||||
'document' => $this->accompanyingCourseDocumentRepository->find($genericDocDTO->identifiers['id']),
|
||||
'accompanyingCourse' => $genericDocDTO->linked,
|
||||
'options' => $options,
|
||||
];
|
||||
}
|
||||
|
||||
// this is a person
|
||||
return [
|
||||
'document' => $this->accompanyingCourseDocumentRepository->find($genericDocDTO->identifiers['id']),
|
||||
'accompanyingCourse' => $genericDocDTO->linked,
|
||||
'document' => $this->personDocumentRepository->find($genericDocDTO->identifiers['id']),
|
||||
'person' => $genericDocDTO->linked,
|
||||
'options' => $options,
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user