public function onAfterDelete()
    {
        parent::onAfterDelete();
        $wfActionInstances = WorkflowActionInstance::get()
            /** @skipUpgrade */
            ->leftJoin('WorkflowInstance', '"WorkflowInstance"."ID" = "WorkflowActionInstance"."WorkflowID"')
            ->where(sprintf('"BaseActionID" = %d AND ("WorkflowStatus" IN (\'Active\',\'Paused\'))', $this->ID));
        foreach ($wfActionInstances as $wfActionInstance) {
            $wfInstances = WorkflowInstance::get()->filter('CurrentActionID', $wfActionInstance->ID);
            foreach ($wfInstances as $wfInstance) {
                $wfInstance->Groups()->removeAll();
                $wfInstance->Users()->removeAll();
                $wfInstance->delete();
            }
            $wfActionInstance->delete();
        }
        // Delete outbound transitions
        $transitions = WorkflowTransition::get()->filter('ActionID', $this->ID);
        foreach ($transitions as $transition) {
            $transition->Groups()->removeAll();
            $transition->Users()->removeAll();
            $transition->delete();
        }
    }
public function onAfterDelete()
    {
        parent::onAfterDelete();
        $wfActionInstances = WorkflowActionInstance::get()
            /** @skipUpgrade */
            ->leftJoin('WorkflowInstance', '"WorkflowInstance"."ID" = "WorkflowActionInstance"."WorkflowID"')
            ->where(sprintf('"BaseActionID" = %d AND ("WorkflowStatus" IN (\'Active\',\'Paused\'))', $this->ID));
        foreach ($wfActionInstances as $wfActionInstance) {
            $wfInstances = WorkflowInstance::get()->filter('CurrentActionID', $wfActionInstance->ID);
            foreach ($wfInstances as $wfInstance) {
                $wfInstance->Groups()->removeAll();
                $wfInstance->Users()->removeAll();
                $wfInstance->delete();
            }
            $wfActionInstance->delete();
        }
        // Delete outbound transitions
        $transitions = WorkflowTransition::get()->filter('ActionID', $this->ID);
        foreach ($transitions as $transition) {
            $transition->Groups()->removeAll();
            $transition->Users()->removeAll();
            $transition->delete();
        }
    }
public function onAfterDelete ( ) { parent :: onAfterDelete ( ) ; $ wfActionInstances = WorkflowActionInstance :: get ( ) /** @skipUpgrade */ -> leftJoin ( 'WorkflowInstance' , '"WorkflowInstance"."ID" = "WorkflowActionInstance"."WorkflowID"' ) -> where ( sprintf ( '"BaseActionID" = %d AND ("WorkflowStatus" IN (\'Active\',\'Paused\'))' , $ this -> ID ) ) ; foreach ( $ wfActionInstances as $ wfActionInstance ) { $ wfInstances = WorkflowInstance :: get ( ) -> filter ( 'CurrentActionID' , $ wfActionInstance -> ID ) ; foreach ( $ wfInstances as $ wfInstance ) { $ wfInstance -> Groups ( ) -> removeAll ( ) ; $ wfInstance -> Users ( ) -> removeAll ( ) ; $ wfInstance -> delete ( ) ; } $ wfActionInstance -> delete ( ) ; } // Delete outbound transitions $ transitions = WorkflowTransition :: get ( ) -> filter ( 'ActionID' , $ this -> ID ) ; foreach ( $ transitions as $ transition ) { $ transition -> Groups ( ) -> removeAll ( ) ; $ transition -> Users ( ) -> removeAll ( ) ; $ transition -> delete ( ) ; } }
When deleting an action from a workflow definition, make sure that workflows currently paused on that action
are deleted
Also removes all outbound transitions
When deleting an action from a workflow definition make sure that workflows currently paused on that action are deleted Also removes all outbound transitions