for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of the Extension "sf_event_mgt" for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
namespace DERHANSEN\SfEventMgt\ViewHelpers\Be;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* ViewHelper to render details about the given backend user
class BackendUserViewHelper extends AbstractViewHelper
{
public function initializeArguments(): void
$this->registerArgument('userUid', 'int', 'UID of backend user', true);
}
public function render(): array
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('be_users');
$queryBuilder->getRestrictions()->removeAll();
$backendUser = $queryBuilder
->select('*')
->from('be_users')
->where(
$queryBuilder->expr()->eq(
'uid',
$queryBuilder->createNamedParameter($this->arguments['userUid'], Connection::PARAM_INT)
)
->executeQuery()
->fetchAssociative();
if ($backendUser === false) {
$backendUser = [];
return $backendUser;