Get the implementation of delivery execution service

@return ServiceProxy
@throws \Zend\ServiceManager\Exception\ServiceNotFoundException
426205
protected function getDeliveryExecutionService()
    {
        if (!$this->deliveryExecutionService) {
            $this->deliveryExecutionService = $this->getServiceLocator()->get(ServiceProxy::SERVICE_ID);
        }
        return $this->deliveryExecutionService;
    }
7886
public function generateDeferred()
    {
        try {
            if (! $this->hasRequestParameter(self::REST_DELIVERY_TEST_ID)) {
                throw new \common_exception_MissingParameter(self::REST_DELIVERY_TEST_ID, $this->getRequestURI());
            }

            $test = $this->getResource($this->getRequestParameter(self::REST_DELIVERY_TEST_ID));
            if (! $test->exists()) {
                throw new \common_exception_NotFound('Unable to find a test associated to the given uri.');
            }

            $deliveryClass = $this->getDeliveryClassByParameters();

            /** @var DeliveryFactory $deliveryFactoryService */
            $deliveryFactoryService = $this->getServiceManager()->get(DeliveryFactory::SERVICE_ID);
            $initialProperties = $deliveryFactoryService->getInitialPropertiesFromRequest($this->getRequest());

            $task = CompileDelivery::createTask($test, $deliveryClass, $initialProperties);

            $result = [
                'reference_id' => $task->getId()
            ];

            /** @var TaskLogInterface $taskLog */
            $taskLog = $this->getServiceManager()->get(TaskLogInterface::SERVICE_ID);

            $report = $taskLog->getReport($task->getId());

            if (!empty($report)) {
                if ($report instanceof \common_report_Report) {
                    //serialize report to array
                    $report = json_decode($report);
                }
                $result['common_report_Report'] = $report;
            }

            return $this->returnSuccess($result);
        } catch (\Exception $e) {
            $this->returnFailure($e);
        }
    }
340287
protected function proxy() {
        if (!$this->context) {
            $this->context = new AvailableAddOnContext($this->version, $this->solution['sid']);
        }

        return $this->context;
    }
659191
public function getCache()
    {
        if ($this->cache) {
            return $this->cache;
        }

        if (property_exists($this, 'app') && $this->app instanceof ServiceContainer
            && isset($this->app['cache']) && $this->app['cache'] instanceof CacheInterface) {
            return $this->cache = $this->app['cache'];
        }

        return $this->cache = $this->createDefaultCache();
    }
35997
protected function proxy() {
        if (!$this->context) {
            $this->context = new FunctionContext(
                $this->version,
                $this->solution['serviceSid'],
                $this->solution['sid']
            );
        }

        return $this->context;
    }
937377
public static function instance()
    {
        if ( self::$instance === null )
        {
            $serviceContainer = ezpKernel::instance()->getServiceContainer();
            self::$instance = new self( $serviceContainer->get( 'ezpublish.api.repository' ) );
        }

        return self::$instance;
    }
655706
public function updateDeferred()
    {
        try {
            if ($this->getRequestMethod() !== \Request::HTTP_POST) {
                throw new \common_exception_NotImplemented('Only post method is accepted to updating delivery');
            }
            if (! $this->hasRequestParameter(self::REST_DELIVERY_SEARCH_PARAMS)) {
                throw new \common_exception_MissingParameter(self::REST_DELIVERY_SEARCH_PARAMS, $this->getRequestURI());
            }
            $where = json_decode(html_entity_decode($this->getRequestParameter(self::REST_DELIVERY_SEARCH_PARAMS)), true);
            $propertyValues = $this->getRequestParameters();
            unset($propertyValues[self::REST_DELIVERY_SEARCH_PARAMS]);

            $task = UpdateDelivery::createTask($where, $propertyValues);

            $result = [
                'reference_id' => $task->getId()
            ];

            /** @var TaskLogInterface $taskLog */
            $taskLog = $this->getServiceManager()->get(TaskLogInterface::SERVICE_ID);
            $report = $taskLog->getReport($task->getId());
            if (!empty($report)) {
                if ($report instanceof \common_report_Report) {
                    //serialize report to array
                    $report = json_decode($report);
                }
                $result['common_report_Report'] = $report;
            }
            return $this->returnSuccess($result);
        }catch (\Exception $e) {
            $this->returnFailure($e);
        }
    }
962256
public function getDeliveryExecutionById($deliveryExecutionId)
    {
        $deliveryExecution = $this->getDeliveryExecutionService()->getDeliveryExecution($deliveryExecutionId);
        try {
            $deliveryExecution->getDelivery();
        } catch (\common_exception_NotFound $e) {
            throw new \common_exception_NotFound('Provided parameters don\'t match with any delivery execution.');
        }
        return $deliveryExecution;
    }
168253
protected function proxy() {
        if (!$this->context) {
            $this->context = new SyncMapContext(
                $this->version,
                $this->solution['serviceSid'],
                $this->solution['sid']
            );
        }

        return $this->context;
    }
594285
public function deliveryAddressStepAction()
    {
        $request = $this->getCurrentRequest();
        $customer = $this->get('sonata.customer.selector')->get();

        if (!$customer) {
            throw new NotFoundHttpException('customer not found');
        }

        $basket = $this->get('sonata.basket');
        $basket->setCustomer($customer);

        if (0 === $basket->countBasketElements()) {
            return new RedirectResponse($this->generateUrl('sonata_basket_index'));
        }

        $addresses = $customer->getAddressesByType(AddressInterface::TYPE_DELIVERY);

        $em = $this->container->get('sonata.address.manager')->getEntityManager();
        foreach ($addresses as $key => $address) {
            // Prevents usage of not persisted addresses in AddressType to avoid choice field error
            // This case occurs when customer is taken from a session
            if (!$em->contains($address)) {
                unset($addresses[$key]);
            }
        }

        // Show address creation / selection form
        $form = $this->createForm(AddressType::class, null, ['addresses' => $addresses]);
        $template = 'SonataBasketBundle:Basket:delivery_address_step.html.twig';

        if ('POST' === $request->getMethod()) {
            $form->handleRequest($request);

            if ($form->isValid()) {
                if ($form->has('useSelected') && $form->get('useSelected')->isClicked()) {
                    $address = $form->get('addresses')->getData();
                } else {
                    $address = $form->getData();
                    $address->setType(AddressInterface::TYPE_DELIVERY);

                    $customer->addAddress($address);

                    $this->get('sonata.customer.manager')->save($customer);

                    $this->get('session')->getFlashBag()->add('sonata_customer_success', 'address_add_success');
                }

                $basket->setCustomer($customer);
                $basket->setDeliveryAddress($address);
                // save the basket
                $this->get('sonata.basket.factory')->save($basket);

                return new RedirectResponse($this->generateUrl('sonata_basket_delivery'));
            }
        }

        // Set URL to be redirected to once edited address
        $this->get('session')->set('sonata_address_redirect', $this->generateUrl('sonata_basket_delivery_address'));

        $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('basket_delivery_title', [], 'SonataBasketBundle'));

        return $this->render($template, [
            'form' => $form->createView(),
            'addresses' => $addresses,
            'basket' => $basket,
        ]);
    }
189808
protected function getExtensionManager()
    {
        if ($this->getServiceLocator()->has(common_ext_ExtensionsManager::SERVICE_ID)) {
            $service = $this->getServiceLocator()->get(common_ext_ExtensionsManager::SERVICE_ID);
        } else {
            $service = new common_ext_ExtensionsManager();
            $this->getServiceLocator()->propagate($service);
        }
        return $service;
    }
282707
public function provide()
    {
        if ($this->service === null) {
            $this->service = $this->createService();
        }

        return $this->service;
    }
1315456
protected function proxy() {
        if (!$this->context) {
            $this->context = new CommandContext($this->version, $this->solution['sid']);
        }

        return $this->context;
    }
701485
public function getDeliveryStatus()
    {
        $status = $this->entity->getDeliveryStatus();
        if ($status !== null) {
            return new DeliveryStatus($status, $this->locale);
        }

        return null;
    }
862999
public function getProxy()
    {
        if ($this->proxy !== null) {
            return $this->proxy;
        }

        return $this->proxy = $this->createProxy();
    }
64103
public function initDeliveryExecution() {
        try {
            $deliveryExecution = $this->_initDeliveryExecution();
            //if authorized we can move to this URL.
            $this->redirect(_url('runDeliveryExecution', null, null, array('deliveryExecution' => $deliveryExecution->getIdentifier())));
        } catch (UnAuthorizedException $e) {
            return $this->redirect($e->getErrorPage());
        } catch (common_exception_Unauthorized $e) {
            return $this->returnJson([
                'success' => false,
                'message' => __('You are no longer allowed to take this test')
            ], 403);
        }
    }
1302867
public function getService()
    {
        if (!$this->service) {
            /** @var \OAuth\ServiceFactory $serviceFactory */
            $serviceFactory = $this->app->make('oauth/factory/service');
            $this->service = $this->factory->createService($serviceFactory);
        }

        return $this->service;
    }