protected function updatePaymentState(PaymentInterface $payment, $nextState)
    {
        if ($payment->getState() !== $nextState) {
            /** @var \Ekyna\Bundle\PaymentBundle\StateMachine\StateMachineInterface $stateMachine */
            $stateMachine = $this->factory->get($payment);
            if (null !== $transition = $stateMachine->getTransitionToState($nextState)) {
                $stateMachine->apply($transition);

                $this->objectManager->flush();
            }
        }
    }
protected function updatePaymentState(PaymentInterface $payment, $nextState)
    {
        if ($payment->getState() !== $nextState) {
            /** @var \Ekyna\Bundle\PaymentBundle\StateMachine\StateMachineInterface $stateMachine */
            $stateMachine = $this->factory->get($payment);
            if (null !== $transition = $stateMachine->getTransitionToState($nextState)) {
                $stateMachine->apply($transition);

                $this->objectManager->flush();
            }
        }
    }
protected function updatePaymentState ( PaymentInterface $ payment , $ nextState ) { if ( $ payment -> getState ( ) !== $ nextState ) { /** @var \Ekyna\Bundle\PaymentBundle\StateMachine\StateMachineInterface $stateMachine */ $ stateMachine = $ this -> factory -> get ( $ payment ) ; if ( null !== $ transition = $ stateMachine -> getTransitionToState ( $ nextState ) ) { $ stateMachine -> apply ( $ transition ) ; $ this -> objectManager -> flush ( ) ; } } }
Updates the payment state.

@param PaymentInterface $payment
@param string           $nextState
Updates the payment state .