public function performTransition(WorkflowTransition $transition)
    {
        // first make sure that the transition is valid to execute!
        $action          = $this->CurrentAction();
        $allTransitions  = $action->BaseAction()->Transitions();

        $valid = $allTransitions->find('ID', $transition->ID);
        if (!$valid) {
            throw new Exception(
                sprintf(_t(
                    'WorkflowInstance.WORKFLOW_TRANSITION_EXCEPTION',
                    'Invalid transition state for action #%s'
                ), $action->ID)
            );
        }

        $action->actionComplete($transition);

        $definition = DataObject::get_by_id(WorkflowAction::class, $transition->NextActionID);
        $action = $definition->getInstanceForWorkflow();
        $action->WorkflowID   = $this->ID;
        $action->write();

        $this->CurrentActionID = $action->ID;
        $this->write();
        $this->components = array(); // manually clear the has_one cache

        $action->actionStart($transition);

        $transition->extend('onTransition');
        $this->execute();
    }
public function performTransition(WorkflowTransition $transition)
    {
        // first make sure that the transition is valid to execute!
        $action          = $this->CurrentAction();
        $allTransitions  = $action->BaseAction()->Transitions();

        $valid = $allTransitions->find('ID', $transition->ID);
        if (!$valid) {
            throw new Exception(
                sprintf(_t(
                    'WorkflowInstance.WORKFLOW_TRANSITION_EXCEPTION',
                    'Invalid transition state for action #%s'
                ), $action->ID)
            );
        }

        $action->actionComplete($transition);

        $definition = DataObject::get_by_id(WorkflowAction::class, $transition->NextActionID);
        $action = $definition->getInstanceForWorkflow();
        $action->WorkflowID   = $this->ID;
        $action->write();

        $this->CurrentActionID = $action->ID;
        $this->write();
        $this->components = array(); // manually clear the has_one cache

        $action->actionStart($transition);

        $transition->extend('onTransition');
        $this->execute();
    }
public function performTransition ( WorkflowTransition $ transition ) { // first make sure that the transition is valid to execute! $ action = $ this -> CurrentAction ( ) ; $ allTransitions = $ action -> BaseAction ( ) -> Transitions ( ) ; $ valid = $ allTransitions -> find ( 'ID' , $ transition -> ID ) ; if ( ! $ valid ) { throw new Exception ( sprintf ( _t ( 'WorkflowInstance.WORKFLOW_TRANSITION_EXCEPTION' , 'Invalid transition state for action #%s' ) , $ action -> ID ) ) ; } $ action -> actionComplete ( $ transition ) ; $ definition = DataObject :: get_by_id ( WorkflowAction :: class , $ transition -> NextActionID ) ; $ action = $ definition -> getInstanceForWorkflow ( ) ; $ action -> WorkflowID = $ this -> ID ; $ action -> write ( ) ; $ this -> CurrentActionID = $ action -> ID ; $ this -> write ( ) ; $ this -> components = array ( ) ; // manually clear the has_one cache $ action -> actionStart ( $ transition ) ; $ transition -> extend ( 'onTransition' ) ; $ this -> execute ( ) ; }
Transitions a workflow to the next step defined by the given transition.

After transitioning, the action is 'executed', and next steps
determined.

@param WorkflowTransition $transition
Transitions a workflow to the next step defined by the given transition .