Handle cases when there are multiple EntityWorkflows associated with one entity

This commit is contained in:
2024-07-15 18:58:08 +02:00
parent 31f842471a
commit 9e92ede16f
9 changed files with 31 additions and 25 deletions

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\DocStoreBundle\Service;
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
use Chill\MainBundle\Workflow\EntityWorkflowManager;
use Symfony\Component\Security\Core\Security;
@@ -21,13 +20,10 @@ class WorkflowDocumentService
public function notBlockedByWorkflow(object $entity): bool
{
/**
* @var EntityWorkflow
*/
$workflow = $this->entityWorkflowManager->findByRelatedEntity($entity);
$workflows = $this->entityWorkflowManager->findByRelatedEntity($entity);
$currentUser = $this->security->getUser();
if (null != $workflow) {
foreach ($workflows as $workflow) {
if ($workflow->isFinal()) {
return false;
}