mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[workflow][method] add method to get involved/suggested users
This commit is contained in:
parent
8b517f169f
commit
9e6579a176
@ -95,6 +95,16 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getSuggestedUsers(EntityWorkflow $entityWorkflow): array
|
||||
{
|
||||
$suggestedUsers = $entityWorkflow->getUsersInvolved();
|
||||
|
||||
$referrer = $this->getRelatedEntity($entityWorkflow)->getCourse()->getUser();
|
||||
$suggestedUsers[$referrer->getId()] = $referrer;
|
||||
|
||||
return $suggestedUsers;
|
||||
}
|
||||
|
||||
public function getTemplate(EntityWorkflow $entityWorkflow, array $options = []): string
|
||||
{
|
||||
return '@ChillDocStore/AccompanyingCourseDocument/_workflow.html.twig';
|
||||
|
@ -348,6 +348,22 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->transitionningStep;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User[]
|
||||
*/
|
||||
public function getUsersInvolved(): array
|
||||
{
|
||||
$usersInvolved = [];
|
||||
|
||||
foreach ($this->steps as $step) {
|
||||
foreach ($step->getDestUser() as $u) {
|
||||
$usersInvolved[$u->getId()] = $u;
|
||||
}
|
||||
}
|
||||
|
||||
return $usersInvolved;
|
||||
}
|
||||
|
||||
public function getWorkflowName(): string
|
||||
{
|
||||
return $this->workflowName;
|
||||
|
@ -36,6 +36,11 @@ interface EntityWorkflowHandlerInterface
|
||||
*/
|
||||
public function getRoleShow(EntityWorkflow $entityWorkflow): ?string;
|
||||
|
||||
/**
|
||||
* @return User[]
|
||||
*/
|
||||
public function getSuggestedUsers(EntityWorkflow $entityWorkflow): array;
|
||||
|
||||
public function getTemplate(EntityWorkflow $entityWorkflow, array $options = []): string;
|
||||
|
||||
public function getTemplateData(EntityWorkflow $entityWorkflow, array $options = []): array;
|
||||
|
@ -97,6 +97,21 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW
|
||||
return AccompanyingPeriodWorkEvaluationDocumentVoter::SEE;
|
||||
}
|
||||
|
||||
public function getSuggestedUsers(EntityWorkflow $entityWorkflow): array
|
||||
{
|
||||
$suggestedUsers = $entityWorkflow->getUsersInvolved();
|
||||
|
||||
$referrer = $this->getRelatedEntity($entityWorkflow)
|
||||
->getAccompanyingPeriodWorkEvaluation()
|
||||
->getAccompanyingPeriodWork()
|
||||
->getAccompanyingPeriod()
|
||||
->getUser();
|
||||
|
||||
$suggestedUsers[$referrer->getId()] = $referrer;
|
||||
|
||||
return $suggestedUsers;
|
||||
}
|
||||
|
||||
public function getTemplate(EntityWorkflow $entityWorkflow, array $options = []): string
|
||||
{
|
||||
return '@ChillPerson/Workflow/_evaluation_document.html.twig';
|
||||
|
@ -87,6 +87,20 @@ class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowH
|
||||
return AccompanyingPeriodWorkEvaluationVoter::SEE;
|
||||
}
|
||||
|
||||
public function getSuggestedUsers(EntityWorkflow $entityWorkflow): array
|
||||
{
|
||||
$suggestedUsers = $entityWorkflow->getUsersInvolved();
|
||||
|
||||
$referrer = $this->getRelatedEntity($entityWorkflow)
|
||||
->getAccompanyingPeriodWork()
|
||||
->getAccompanyingPeriod()
|
||||
->getUser();
|
||||
|
||||
$suggestedUsers[$referrer->getId()] = $referrer;
|
||||
|
||||
return $suggestedUsers;
|
||||
}
|
||||
|
||||
public function getTemplate(EntityWorkflow $entityWorkflow, array $options = []): string
|
||||
{
|
||||
return '@ChillPerson/Workflow/_evaluation.html.twig';
|
||||
|
@ -94,6 +94,19 @@ class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInte
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getSuggestedUsers(EntityWorkflow $entityWorkflow): array
|
||||
{
|
||||
$suggestedUsers = $entityWorkflow->getUsersInvolved();
|
||||
|
||||
$referrer = $this->getRelatedEntity($entityWorkflow)
|
||||
->getAccompanyingPeriod()
|
||||
->getUser();
|
||||
|
||||
$suggestedUsers[$referrer->getId()] = $referrer;
|
||||
|
||||
return $suggestedUsers;
|
||||
}
|
||||
|
||||
public function getTemplate(EntityWorkflow $entityWorkflow, array $options = []): string
|
||||
{
|
||||
return '@ChillPerson/Workflow/_accompanying_period_work.html.twig';
|
||||
|
Loading…
x
Reference in New Issue
Block a user