mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\MainBundle\Workflow\Notification;
|
|
|
|
use Chill\MainBundle\Entity\Notification;
|
|
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
|
use Chill\MainBundle\Notification\NotificationHandlerInterface;
|
|
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
|
use Chill\MainBundle\Workflow\EntityWorkflowManager;
|
|
|
|
class WorkflowNotificationHandler implements NotificationHandlerInterface
|
|
{
|
|
private EntityWorkflowManager $entityWorkflowManager;
|
|
|
|
private EntityWorkflowRepository $entityWorkflowRepository;
|
|
|
|
public function getTemplate(Notification $notification, array $options = []): string
|
|
{
|
|
return '@ChillMain/Workflow/_notification_include.html.twig';
|
|
}
|
|
|
|
public function getTemplateData(Notification $notification, array $options = []): array
|
|
{
|
|
$entityWorkflow = $this->entityWorkflowRepository->find($notification->getRelatedEntityId());
|
|
|
|
return [
|
|
'entity_workflow' => $entityWorkflow,
|
|
'handler' => $this->entityWorkflowManager->getHandler($entityWorkflow),
|
|
];
|
|
}
|
|
|
|
public function supports(Notification $notification, array $options = []): bool
|
|
{
|
|
return $notification->getRelatedEntityClass() === EntityWorkflow::class;
|
|
}
|
|
}
|