public function addTransition($stateId, $nextStateId, $eventId)
    {
        $state = $this->stateMachine->getState($stateId);
        if ($state === null) {
            throw new StateNotFoundException(sprintf('The state "%s" is not found.', $stateId));
        }

        $nextState = $this->stateMachine->getState($nextStateId);
        if ($nextState === null) {
            throw new StateNotFoundException(sprintf('The state "%s" is not found.', $nextStateId));
        }

        $event = $state->getTransitionEvent($eventId);
        if ($event === null) {
            $event = new Event($eventId);
        }

        $this->stateMachine->addTransition(new Transition($nextState, $state, $event));
    }
public function addTransition($stateId, $nextStateId, $eventId)
    {
        $state = $this->stateMachine->getState($stateId);
        if ($state === null) {
            throw new StateNotFoundException(sprintf('The state "%s" is not found.', $stateId));
        }

        $nextState = $this->stateMachine->getState($nextStateId);
        if ($nextState === null) {
            throw new StateNotFoundException(sprintf('The state "%s" is not found.', $nextStateId));
        }

        $event = $state->getTransitionEvent($eventId);
        if ($event === null) {
            $event = new Event($eventId);
        }

        $this->stateMachine->addTransition(new Transition($nextState, $state, $event));
    }
public function addTransition ( $ stateId , $ nextStateId , $ eventId ) { $ state = $ this -> stateMachine -> getState ( $ stateId ) ; if ( $ state === null ) { throw new StateNotFoundException ( sprintf ( 'The state "%s" is not found.' , $ stateId ) ) ; } $ nextState = $ this -> stateMachine -> getState ( $ nextStateId ) ; if ( $ nextState === null ) { throw new StateNotFoundException ( sprintf ( 'The state "%s" is not found.' , $ nextStateId ) ) ; } $ event = $ state -> getTransitionEvent ( $ eventId ) ; if ( $ event === null ) { $ event = new Event ( $ eventId ) ; } $ this -> stateMachine -> addTransition ( new Transition ( $ nextState , $ state , $ event ) ) ; }
Adds an state transition to the state machine.

@param string $stateId
@param string $nextStateId
@param string $eventId

@throws StateNotFoundException
Adds an state transition to the state machine .