mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 11:33:49 +00:00
FEATURE [genericDoc][activity] finalize implementation
This commit is contained in:
@@ -27,32 +27,19 @@ final class AccompanyingPeriodActivityGenericDocProvider implements GenericDocFo
|
||||
{
|
||||
public const KEY = 'accompanying_period_activity_document';
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private Security $security;
|
||||
|
||||
public function __construct(Security $security, EntityManagerInterface $entityManager)
|
||||
{
|
||||
$this->em = $entityManager;
|
||||
$this->security = $security;
|
||||
public function __construct(
|
||||
private EntityManagerInterface $em,
|
||||
private Security $security
|
||||
){
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AccompanyingPeriod $accompanyingPeriod
|
||||
* @param DateTimeImmutable|null $startDate
|
||||
* @param DateTimeImmutable|null $endDate
|
||||
* @param string|null $content
|
||||
* @param string|null $origin
|
||||
* @return FetchQueryInterface
|
||||
* @throws MappingException
|
||||
*/
|
||||
public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
|
||||
{
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
|
||||
$query = new FetchQuery(
|
||||
self::KEY,
|
||||
"jsonb_build_object('id', doc_obj.id)",
|
||||
"jsonb_build_object('id', doc_obj.id, 'activity_id', activity.id)",
|
||||
'doc_obj.'.$storedObjectMetadata->getColumnName('createdAt'),
|
||||
$storedObjectMetadata->getSchemaName().'.'.$storedObjectMetadata->getTableName().' AS doc_obj'
|
||||
);
|
||||
|
@@ -36,13 +36,13 @@ final class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRe
|
||||
|
||||
public function getTemplate(GenericDocDTO $genericDocDTO, $options = []): string
|
||||
{
|
||||
return '@ChillCalendar/GenericDoc/activity_document.html.twig';
|
||||
return '@ChillActivity/GenericDoc/activity_document.html.twig';
|
||||
}
|
||||
|
||||
public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array
|
||||
{
|
||||
return [
|
||||
'activity' => $this->activityRepository->findOneByDocument($genericDocDTO->identifiers['id']),
|
||||
'activity' => $this->activityRepository->find($genericDocDTO->identifiers['activity_id']),
|
||||
'document' => $this->objectRepository->find($genericDocDTO->identifiers['id'])
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user