feat(workflow) : valide que task.status appartient au workflow du projet

This commit is contained in:
2026-05-19 19:57:07 +02:00
parent eec61c089c
commit cf94635121

View File

@@ -478,4 +478,26 @@ class Task
; ;
} }
} }
#[Assert\Callback]
public function validateStatusBelongsToProjectWorkflow(ExecutionContextInterface $context): void
{
if (null === $this->status || null === $this->project) {
return;
}
$projectWorkflow = $this->project->getWorkflow();
$statusWorkflow = $this->status->getWorkflow();
if (null === $projectWorkflow || null === $statusWorkflow) {
return;
}
if ($projectWorkflow->getId() !== $statusWorkflow->getId()) {
$context->buildViolation('Status does not belong to this project\'s workflow.')
->atPath('status')
->addViolation()
;
}
}
} }