improve title rendering on workflows

This commit is contained in:
2022-02-25 12:09:53 +01:00
parent b7d6d69101
commit 2b257cc402
5 changed files with 39 additions and 12 deletions

View File

@@ -13,6 +13,7 @@ namespace Chill\DocStoreBundle\Workflow;
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Doctrine\ORM\EntityManagerInterface;
@@ -28,8 +29,10 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
/**
* TODO: injecter le repository directement.
*/
public function __construct(EntityManagerInterface $em, TranslatorInterface $translator)
{
public function __construct(
EntityManagerInterface $em,
TranslatorInterface $translator
) {
$this->repository = $em->getRepository(AccompanyingCourseDocument::class);
$this->translator = $translator;
}
@@ -53,7 +56,11 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
public function getEntityTitle(EntityWorkflow $entityWorkflow, array $options = []): string
{
return $this->translator->trans('workflow.Document (n°%doc%)', ['%doc%' => $entityWorkflow->getRelatedEntityId()]);
$doc = $this->getRelatedEntity($entityWorkflow);
return $this->translator->trans('workflow.Document (n°%doc%)', ['%doc%' => $entityWorkflow->getRelatedEntityId()])
.' - '.$doc->getTitle()
;
}
public function getRelatedEntity(EntityWorkflow $entityWorkflow): ?AccompanyingCourseDocument