izzum\statemachine\StateMachine::performTransition PHP Method

performTransition() private method

Perform a transition by specifiying the transitions' name from a state that the transition is allowed to run.
private performTransition ( Transition $transition, string $message = null ) : boolean
$transition Transition
$message string optional message. this can be used by the persistence adapter to be part of the transition history to provide extra information about the transition.
return boolean true if the transition was succesful
    private function performTransition(Transition $transition, $message = null)
    {
        // every method in this core routine has hook methods, event handlers and
        // callbacks it can call during the execution phase of the
        // transition steps if they are available on the domain model.
        try {
            if (!$this->doCheckCanTransition($transition)) {
                // one of the guards returned false or transition not found on current state.
                return false;
            }
            // state exit action: performed when exiting the state
            $this->doExitState($transition);
            // the transition is performed, with the associated logic
            $this->doTransition($transition, $message);
            // state entry action: performed when entering the state
            $this->doEnterState($transition);
        } catch (Exception $e) {
            $this->handlePossibleNonStatemachineException($e, Exception::SM_TRANSITION_FAILED, $transition);
        }
        return true;
    }