getServiceManager()->get(QueueDispatcher::SERVICE_ID); $report = \common_report_Report::createInfo('Deleting delivery: ' . $params['deliveryId']); try { /** @var DeliveryDeleteService $deleteDeliveryService */ $deleteDeliveryService = $this->getServiceLocator()->get(DeliveryDeleteService::SERVICE_ID); $request = new DeliveryDeleteRequest($params['deliveryId']); $deleteDeliveryService->execute($request, true); $delivery = $request->getDeliveryResource(); if ($deleteDeliveryService->hasDeliveryExecutions($delivery)) { $queueDispatcher->createTask($this, $params, __('Continue deleting of delivery "%s".', $delivery->getLabel())); $this->logInfo('Queued task to continue delete delivery ' . $delivery->getLabel()); } $report->add($deleteDeliveryService->getReport()); } catch (\Exception $exception) { $report->add(\common_report_Report::createFailure($exception->getMessage())); } return $report; } /** * @return mixed|string */ public function jsonSerialize() { return __CLASS__; } }