mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
add informations to workflow normalization
This commit is contained in:
@@ -15,17 +15,34 @@ use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInterface
|
||||
{
|
||||
private AccompanyingPeriodWorkRepository $repository;
|
||||
|
||||
public function __construct(AccompanyingPeriodWorkRepository $repository)
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(AccompanyingPeriodWorkRepository $repository, TranslatorInterface $translator)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function getRelatedEntity(EntityWorkflow $entityWorkflow): ?object
|
||||
public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array
|
||||
{
|
||||
return [
|
||||
'persons' => $this->getRelatedEntity($entityWorkflow)
|
||||
->getPersons(),
|
||||
];
|
||||
}
|
||||
|
||||
public function getEntityTitle(EntityWorkflow $entityWorkflow, array $options = []): string
|
||||
{
|
||||
return $this->translator->trans('workflow.Work (n°%w%)', ['%w%' => $entityWorkflow->getRelatedEntityId()]);
|
||||
}
|
||||
|
||||
public function getRelatedEntity(EntityWorkflow $entityWorkflow): ?AccompanyingPeriodWork
|
||||
{
|
||||
return $this->repository->find($entityWorkflow->getRelatedEntityId());
|
||||
}
|
||||
|
Reference in New Issue
Block a user