izzum\statemachine\StateMachine::doTransition PHP Method

doTransition() private method

the transition action method
private doTransition ( Transition $transition, string $message = null )
$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.
    private function doTransition(Transition $transition, $message = null)
    {
        // hook for subclasses to implement
        $this->_onTransition($transition);
        $entity = $this->getContext()->getEntity();
        $identifier = $this->getContext()->getIdentifier();
        // an event handler that is possibly defined on the domain model: onTransition
        $this->callEventHandler($entity, 'onTransition', $identifier, $transition);
        // executes the command and callable associated with the transition object
        $transition->process($this->getContext());
        // this actually sets the state so we are now in the new state
        $this->setState($transition->getStateTo(), $message);
    }