mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 03:23:48 +00:00
Add suggested persons and third parties methods
Introduced getSuggestedPersons and getSuggestedThirdParties methods across various WorkflowHandlers. These methods integrate with ProvidePersonsAssociated and ProvideThirdPartiesAssociated services to fetch related entities, enhancing the workflow handling capabilities.
This commit is contained in:
@@ -20,6 +20,8 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluatio
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
|
||||
use Chill\PersonBundle\Service\AccompanyingPeriodWork\ProvidePersonsAssociated;
|
||||
use Chill\PersonBundle\Service\AccompanyingPeriodWork\ProvideThirdPartiesAssociated;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
@@ -32,6 +34,8 @@ readonly class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHa
|
||||
private EntityWorkflowRepository $workflowRepository,
|
||||
private TranslatableStringHelperInterface $translatableStringHelper,
|
||||
private TranslatorInterface $translator,
|
||||
private ProvideThirdPartiesAssociated $thirdPartiesAssociated,
|
||||
private ProvidePersonsAssociated $providePersonsAssociated,
|
||||
) {}
|
||||
|
||||
public function getDeletionRoles(): array
|
||||
@@ -151,4 +155,26 @@ readonly class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHa
|
||||
|
||||
return $this->workflowRepository->findByRelatedEntity(AccompanyingPeriodWork::class, $object->getId());
|
||||
}
|
||||
|
||||
public function getSuggestedPersons(EntityWorkflow $entityWorkflow): array
|
||||
{
|
||||
$related = $this->getRelatedEntity($entityWorkflow);
|
||||
|
||||
if (null === $related) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->providePersonsAssociated->getPersonsAssociated($related);
|
||||
}
|
||||
|
||||
public function getSuggestedThirdParties(EntityWorkflow $entityWorkflow): array
|
||||
{
|
||||
$related = $this->getRelatedEntity($entityWorkflow);
|
||||
|
||||
if (null === $related) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->thirdPartiesAssociated->getThirdPartiesAssociated($related);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user