function NodeStatisticsDatabaseStorage::fetchViews

Same name in other branches
  1. 9 core/modules/statistics/src/NodeStatisticsDatabaseStorage.php \Drupal\statistics\NodeStatisticsDatabaseStorage::fetchViews()
  2. 8.9.x core/modules/statistics/src/NodeStatisticsDatabaseStorage.php \Drupal\statistics\NodeStatisticsDatabaseStorage::fetchViews()
  3. 10 core/modules/statistics/src/NodeStatisticsDatabaseStorage.php \Drupal\statistics\NodeStatisticsDatabaseStorage::fetchViews()
1 call to NodeStatisticsDatabaseStorage::fetchViews()
NodeStatisticsDatabaseStorage::fetchView in core/modules/statistics/src/NodeStatisticsDatabaseStorage.php

File

core/modules/statistics/src/NodeStatisticsDatabaseStorage.php, line 73

Class

NodeStatisticsDatabaseStorage
Provides the default database storage backend for statistics.

Namespace

Drupal\statistics

Code

public function fetchViews($ids) {
    $views = $this->connection
        ->select('node_counter', 'nc')
        ->fields('nc', [
        'totalcount',
        'daycount',
        'timestamp',
    ])
        ->condition('nid', $ids, 'IN')
        ->execute()
        ->fetchAll();
    foreach ($views as $id => $view) {
        $views[$id] = new StatisticsViewsResult($view->totalcount, $view->daycount, $view->timestamp);
    }
    return $views;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.