bookmark-pages/Classes/Widgets/Provider/TopLikesDataProvider.php

39 lines
981 B
PHP
Raw Normal View History

2021-08-17 19:45:38 +02:00
<?php
declare(strict_types=1);
namespace WapplerSystems\BookmarksLikesRatings\Widgets\Provider;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Dashboard\Widgets\ListDataProviderInterface;
class TopLikesDataProvider implements ListDataProviderInterface
{
public function __construct()
{
}
public function getItems(): array
{
/** @var QueryBuilder $queryBuilder */
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('be_users');
return $queryBuilder
->count('*')
->from('be_users')
->where(
$queryBuilder->expr()->eq(
'admin',
$queryBuilder->createNamedParameter(0, Connection::PARAM_INT)
)
)
->execute();
}
}