Details
-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
2.4.0
-
None
Description
The deleteWorkflowMetadata() method implemented in WorkflowHandler.php is using two unnecessary methods:
- deleteTransitionMetadataForWorkflow()
- deleteMarkingForWorkflow()
I noticed in the ezeditorialworkflow_transitions and ezeditorialworkflow_markings table definition following constraints:
CONSTRAINT `fk_ezeditorialworkflow_markings_workflow_id` FOREIGN KEY (`workflow_id`) REFERENCES `ezeditorialworkflow_workflows` (`id`) ON DELETE CASCADE
and
CONSTRAINT `fk_ezeditorialworkflow_transitions_workflow_id` FOREIGN KEY (`workflow_id`) REFERENCES `ezeditorialworkflow_workflows` (`id`) ON DELETE CASCADE
which has a referential action for a foreign key that allows us to delete data from child/related tables automatically when we delete the data from the parent table ezeditorialworkflow_workflows.
We can remove some methods in the Handler and the Gateway as well and just keep the deleteWorkflowMetadata() method