Ensure workflow was trashed before deleting it

[MAILPOET-4540]
This commit is contained in:
Jan Jakes
2022-10-14 10:01:32 +02:00
committed by David Remer
parent 1b20bf45dd
commit 506cb8b732
3 changed files with 30 additions and 0 deletions

View File

@ -21,6 +21,11 @@ class DeleteWorkflowController {
if (!$workflow) {
throw Exceptions::workflowNotFound($id);
}
if ($workflow->getStatus() !== Workflow::STATUS_TRASH) {
throw Exceptions::workflowNotTrashed($id);
}
$this->workflowStorage->deleteWorkflow($workflow);
return $workflow;
}