public function transitionPaymentAction(Request $request)
    {
        $context = $this->loadContext($request);
        $resourceName = $this->config->getResourceName();

        /** @var \Ekyna\Component\Sale\Order\OrderInterface $order */
        $order = $context->getResource($resourceName);

        $this->isGranted('EDIT', $order);

        $payment = null;
        $paymentId = intval($request->attributes->get('paymentId'));
        foreach ($order->getPayments() as $p) {
            if ($p->getId() === $paymentId) {
                $payment = $p;
                break;
            }
        }
        if (null === $payment) {
            throw new NotFoundHttpException('Payment not found');
        }

        $this->applyPaymentTransition($payment, $request->attributes->get('transition'));

        return $this->redirect($this->generateUrl(
            $this->config->getRoute('show'),
            $context->getIdentifiers(true)
        ));
    }
public function transitionPaymentAction(Request $request)
    {
        $context = $this->loadContext($request);
        $resourceName = $this->config->getResourceName();

        /** @var \Ekyna\Component\Sale\Order\OrderInterface $order */
        $order = $context->getResource($resourceName);

        $this->isGranted('EDIT', $order);

        $payment = null;
        $paymentId = intval($request->attributes->get('paymentId'));
        foreach ($order->getPayments() as $p) {
            if ($p->getId() === $paymentId) {
                $payment = $p;
                break;
            }
        }
        if (null === $payment) {
            throw new NotFoundHttpException('Payment not found');
        }

        $this->applyPaymentTransition($payment, $request->attributes->get('transition'));

        return $this->redirect($this->generateUrl(
            $this->config->getRoute('show'),
            $context->getIdentifiers(true)
        ));
    }
public function transitionPaymentAction ( Request $ request ) { $ context = $ this -> loadContext ( $ request ) ; $ resourceName = $ this -> config -> getResourceName ( ) ; /** @var \Ekyna\Component\Sale\Order\OrderInterface $order */ $ order = $ context -> getResource ( $ resourceName ) ; $ this -> isGranted ( 'EDIT' , $ order ) ; $ payment = null ; $ paymentId = intval ( $ request -> attributes -> get ( 'paymentId' ) ) ; foreach ( $ order -> getPayments ( ) as $ p ) { if ( $ p -> getId ( ) === $ paymentId ) { $ payment = $ p ; break ; } } if ( null === $ payment ) { throw new NotFoundHttpException ( 'Payment not found' ) ; } $ this -> applyPaymentTransition ( $ payment , $ request -> attributes -> get ( 'transition' ) ) ; return $ this -> redirect ( $ this -> generateUrl ( $ this -> config -> getRoute ( 'show' ) , $ context -> getIdentifiers ( true ) ) ) ; }
Transition payment action.

@param Request $request
@return \Symfony\Component\HttpFoundation\RedirectResponse
Transition payment action .