function NodeStatisticsDatabaseStorage::fetchAll
Same name in other branches
- 9 core/modules/statistics/src/NodeStatisticsDatabaseStorage.php \Drupal\statistics\NodeStatisticsDatabaseStorage::fetchAll()
- 10 core/modules/statistics/src/NodeStatisticsDatabaseStorage.php \Drupal\statistics\NodeStatisticsDatabaseStorage::fetchAll()
- 11.x core/modules/statistics/src/NodeStatisticsDatabaseStorage.php \Drupal\statistics\NodeStatisticsDatabaseStorage::fetchAll()
Overrides StatisticsStorageInterface::fetchAll
File
-
core/
modules/ statistics/ src/ NodeStatisticsDatabaseStorage.php, line 93
Class
- NodeStatisticsDatabaseStorage
- Provides the default database storage backend for statistics.
Namespace
Drupal\statisticsCode
public function fetchAll($order = 'totalcount', $limit = 5) {
assert(in_array($order, [
'totalcount',
'daycount',
'timestamp',
]), "Invalid order argument.");
return $this->connection
->select('node_counter', 'nc')
->fields('nc', [
'nid',
])
->orderBy($order, 'DESC')
->range(0, $limit)
->execute()
->fetchCol();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.