mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-04 20:39:40 +00:00
Implement logic to check if editing of document is blocked by workflow
Using the workflow handlers we return the workflow that is attached to an object so that within the workflowDocumentService we can then check whether this workflow blocks the edition of a document.
This commit is contained in:
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Workflow;
|
||||
|
||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
||||
@@ -22,7 +23,12 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowHandlerInterface
|
||||
{
|
||||
public function __construct(private readonly AccompanyingPeriodWorkEvaluationRepository $repository, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly TranslatorInterface $translator) {}
|
||||
public function __construct(
|
||||
private readonly AccompanyingPeriodWorkEvaluationRepository $repository,
|
||||
private readonly EntityWorkflowRepository $workflowRepository,
|
||||
private readonly TranslatableStringHelperInterface $translatableStringHelper,
|
||||
private readonly TranslatorInterface $translator
|
||||
) {}
|
||||
|
||||
public function getDeletionRoles(): array
|
||||
{
|
||||
@@ -114,4 +120,13 @@ class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowH
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function findByRelatedEntity(object $object): ?EntityWorkflow
|
||||
{
|
||||
if (!$object instanceof AccompanyingPeriodWorkEvaluation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->workflowRepository->findByRelatedEntity(AccompanyingPeriodWorkEvaluation::class, $object->getId());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user