collection = $collectionFactory->create(); $this->logDetailsFormatter = $logDetailsFormatter; $this->localeDate = $localeDate; } public function getData() { $data = parent::getData(); if ($data['totalRecords'] > 0) { $data['items'][0]['date'] = $this->localeDate->formatDateTime( $data['items'][0]['date'], \IntlDateFormatter::MEDIUM, \IntlDateFormatter::MEDIUM ); $logId = (int)$data['items'][0]['id']; $data[$logId]['log_entry'] = $data['items'][0]; try { $data[$logId]['log_entry'][LogEntry::LOG_DETAILS] = array_values( $this->logDetailsFormatter->format($logId) ); } catch (\RuntimeException $e) { $data[$logId]['log_entry']['messages'] = [ 'isError' => true, 'message' => $e->getMessage() ]; $data[$logId]['log_entry'][LogEntry::LOG_DETAILS] = []; } } return $data; } }