updateDeliveryLabels($resourceUri, $metadataValue); $report->add(Report::createSuccess(__('Resource update task is completed'))); return $report; } /** * @param string $resourceUri * @param string $metadataValue * @return bool */ public function updateDeliveryLabels($resourceUri, $metadataValue) { /** @var DeliveryMonitoringService $service */ $service = $this->getServiceLocator()->get(DeliveryMonitoringService::SERVICE_ID); $deliveryExecutionsData = $service->find([ DeliveryMonitoringService::DELIVERY_ID => $resourceUri, ], []); foreach ($deliveryExecutionsData as $data) { $data->update(DeliveryMonitoringService::DELIVERY_NAME, $metadataValue); $success = $service->partialSave($data); if (!$success) { \common_Logger::w('Monitor cache for delivery ' . $data[DeliveryMonitoringService::DELIVERY_EXECUTION_ID] . ' could not be updated. Label has not been changed'); } } return true; } /** * @return mixed|string */ public function jsonSerialize() { return __CLASS__; } }