public function postTriggerAction($id, Request $request)
    {
        $status = $request->get('action');
        $em = $this->getDoctrine()->getManager();

        try {
            $order = $this->getManager()->findByIdAndLocale(
                $id,
                $this->getLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'))
            );
            if (!$order) {
                throw new OrderNotFoundException($id);
            }

            switch ($status) {
                case 'confirm':
                    $this->getManager()->convertStatus($order, OrderStatus::STATUS_CONFIRMED);
                    break;
                case 'edit':
                    $this->getManager()->convertStatus($order, OrderStatus::STATUS_CREATED);
                    break;
                default:
                    throw new RestException("Unrecognized status: " . $status);
            }

            $em->flush();
            $view = $this->view($order, 200);
        } catch (OrderNotFoundException $exc) {
            $exception = new EntityNotFoundException($exc->getEntityName(), $exc->getId());
            $view = $this->view($exception->toArray(), 404);
        }

        return $this->handleView($view);
    }
public function postTriggerAction($id, Request $request)
    {
        $status = $request->get('action');
        $em = $this->getDoctrine()->getManager();

        try {
            $order = $this->getManager()->findByIdAndLocale(
                $id,
                $this->getLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'))
            );
            if (!$order) {
                throw new OrderNotFoundException($id);
            }

            switch ($status) {
                case 'confirm':
                    $this->getManager()->convertStatus($order, OrderStatus::STATUS_CONFIRMED);
                    break;
                case 'edit':
                    $this->getManager()->convertStatus($order, OrderStatus::STATUS_CREATED);
                    break;
                default:
                    throw new RestException("Unrecognized status: " . $status);
            }

            $em->flush();
            $view = $this->view($order, 200);
        } catch (OrderNotFoundException $exc) {
            $exception = new EntityNotFoundException($exc->getEntityName(), $exc->getId());
            $view = $this->view($exception->toArray(), 404);
        }

        return $this->handleView($view);
    }
public function postTriggerAction ( $ id , Request $ request ) { $ status = $ request -> get ( 'action' ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; try { $ order = $ this -> getManager ( ) -> findByIdAndLocale ( $ id , $ this -> getLocaleManager ( ) -> retrieveLocale ( $ this -> getUser ( ) , $ request -> get ( 'locale' ) ) ) ; if ( ! $ order ) { throw new OrderNotFoundException ( $ id ) ; } switch ( $ status ) { case 'confirm' : $ this -> getManager ( ) -> convertStatus ( $ order , OrderStatus :: STATUS_CONFIRMED ) ; break ; case 'edit' : $ this -> getManager ( ) -> convertStatus ( $ order , OrderStatus :: STATUS_CREATED ) ; break ; default : throw new RestException ( "Unrecognized status: " . $ status ) ; } $ em -> flush ( ) ; $ view = $ this -> view ( $ order , 200 ) ; } catch ( OrderNotFoundException $ exc ) { $ exception = new EntityNotFoundException ( $ exc -> getEntityName ( ) , $ exc -> getId ( ) ) ; $ view = $ this -> view ( $ exception -> toArray ( ) , 404 ) ; } return $ this -> handleView ( $ view ) ; }
Triggers actions like status conversion.

@Post("/orders/{id}")

@param $id
@param Request $request

@throws EntityNotFoundException
@throws RestException

@return Response
Triggers actions like status conversion .