*/ class UpdateLastConnectivity implements Action { public function __invoke($params) { $serviceManager = ServiceManager::getServiceManager(); /** @var DeliveryMonitoringService $monitoring */ $monitoring = $serviceManager->get(DeliveryMonitoringService::SERVICE_ID); $data = $monitoring->find(); $executions = 0; foreach ($data as $deliveryData) { try { $deliveryData->updateData([ DeliveryMonitoringService::CONNECTIVITY ]); $monitoring->partialSave($deliveryData); $executions++; } catch (\common_exception_NotFound $e) { //Delivery execution not found; Skip } } return new Report( Report::TYPE_INFO, $executions . ' delivery executions updated' ); } }