mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Create CancelStaleWorkflow message and handler
This commit is contained in:
parent
bf056046ab
commit
860ae5cedf
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Service\Workflow;
|
||||||
|
|
||||||
|
class CancelStaleWorkflow
|
||||||
|
{
|
||||||
|
public function __construct(public array $workflowIds)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWorkflowIds(): array
|
||||||
|
{
|
||||||
|
return $this->workflowIds;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Service\Workflow;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||||
|
|
||||||
|
class CancelStaleWorkflowHandler implements MessageHandlerInterface
|
||||||
|
{
|
||||||
|
public function __construct(private readonly EntityWorkflowRepository $workflowRepository, private EntityManagerInterface $em, private LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __invoke(CancelStaleWorkflow $message): void
|
||||||
|
{
|
||||||
|
$workflowIds = $message->getWorkflowIds();
|
||||||
|
|
||||||
|
foreach ($workflowIds as $workflowId) {
|
||||||
|
$workflow = $this->workflowRepository->find($workflowId);
|
||||||
|
|
||||||
|
$steps = $workflow->getSteps();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user