protected function TopController::getRowData in MongoDB 8.2
Obtain the data from the logger.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request. Needed for paging.
string $type: The type of top list to retrieve.
Return value
array The data array.
1 call to TopController::getRowData()
- TopController::build in modules/
mongodb_watchdog/ src/ Controller/ TopController.php - Controller.
File
- modules/
mongodb_watchdog/ src/ Controller/ TopController.php, line 176
Class
- TopController
- The Top403/Top404 controllers.
Namespace
Drupal\mongodb_watchdog\ControllerCode
protected function getRowData(Request $request, string $type) : array {
// Find _id for the error type.
$templateCollection = $this->watchdog
->templateCollection();
$template = $templateCollection
->findOne([
'type' => $type,
], [
'_id',
]);
if (empty($template)) {
return [];
}
// Find occurrences of error type.
$collectionName = $template['_id'];
$eventCollection = $this->watchdog
->eventCollection($collectionName);
$counts = $this
->group($eventCollection, 'variables.@uri', []);
$page = $this
->setupPager($request, count($counts));
$skip = $page * $this->itemsPerPage;
$counts = array_slice($counts, $skip, $this->itemsPerPage);
return $counts;
}