mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
48 lines
1.8 KiB
PHP
48 lines
1.8 KiB
PHP
<?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\PersonBundle\Notification;
|
|
|
|
use Chill\MainBundle\Entity\Notification;
|
|
use Chill\MainBundle\Notification\NotificationHandlerInterface;
|
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument;
|
|
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocumentRepository;
|
|
|
|
final class AccompanyingPeriodWorkEvaluationDocumentNotificationHandler implements NotificationHandlerInterface
|
|
{
|
|
private AccompanyingPeriodWorkEvaluationDocumentRepository $accompanyingPeriodWorkEvaluationDocumentRepository;
|
|
|
|
public function __construct(AccompanyingPeriodWorkEvaluationDocumentRepository $accompanyingPeriodWorkEvaluationDocumentRepository)
|
|
{
|
|
$this->accompanyingPeriodWorkEvaluationDocumentRepository = $accompanyingPeriodWorkEvaluationDocumentRepository;
|
|
}
|
|
|
|
public function getTemplate(Notification $notification, array $options = []): string
|
|
{
|
|
return '@ChillPerson/AccompanyingCourseWork/showEvaluationDocumentInNotification.html.twig';
|
|
}
|
|
|
|
public function getTemplateData(Notification $notification, array $options = []): array
|
|
{
|
|
return [
|
|
'notification' => $notification,
|
|
'document' => $doc = $this->accompanyingPeriodWorkEvaluationDocumentRepository->find($notification->getRelatedEntityId()),
|
|
'evaluation' => $doc?->getAccompanyingPeriodWorkEvaluation(),
|
|
];
|
|
}
|
|
|
|
public function supports(Notification $notification, array $options = []): bool
|
|
{
|
|
return $notification->getRelatedEntityClass() === AccompanyingPeriodWorkEvaluationDocument::class;
|
|
}
|
|
}
|