fix: force status 'completed' on ended dispositions
This commit is contained in:
@@ -5,13 +5,11 @@ namespace App\Service\Cron;
|
|||||||
use App\Entity\Disposition;
|
use App\Entity\Disposition;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Workflow\WorkflowInterface;
|
|
||||||
|
|
||||||
class DispositionStatusService
|
class DispositionStatusService
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
private readonly WorkflowInterface $dispositionStateMachine,
|
|
||||||
private readonly LoggerInterface $logger
|
private readonly LoggerInterface $logger
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
@@ -28,9 +26,7 @@ class DispositionStatusService
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($endedDispositions as $disposition) {
|
foreach ($endedDispositions as $disposition) {
|
||||||
if ($this->dispositionStateMachine->can($disposition, 'complete')) {
|
$disposition->setStatus(Disposition::STATUS_COMPLETED);
|
||||||
$this->dispositionStateMachine->apply($disposition, 'complete');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|||||||
Reference in New Issue
Block a user