WIP [genericDoc][activity] implementing generic doc for activities

This commit is contained in:
2023-05-30 16:59:16 +02:00
parent 47a3e30ec5
commit 9eb9a9a214
2 changed files with 155 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\ActivityBundle\Service\GenericDoc\Renderers;
use Chill\ActivityBundle\Service\GenericDoc\Providers\AccompanyingPeriodActivityGenericDocProvider;
use Chill\DocStoreBundle\GenericDoc\GenericDocDTO;
use Chill\DocStoreBundle\GenericDoc\Twig\GenericDocRendererInterface;
use Chill\DocStoreBundle\Repository\StoredObjectRepository;
final class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRendererInterface
{
private StoredObjectRepository $repository;
public function __construct(StoredObjectRepository $storedObjectRepository)
{
$this->repository = $storedObjectRepository;
}
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
{
return $genericDocDTO->key === AccompanyingPeriodActivityGenericDocProvider::KEY;
}
public function getTemplate(GenericDocDTO $genericDocDTO, $options = []): string
{
return '@ChillCalendar/GenericDoc/activity_document.html.twig';
}
public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array
{
return [
'document' => $this->repository->find($genericDocDTO->identifiers['id'])
];
}
}