‪TYPO3CMS  ‪main
FrontendUserGroupRepository.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
22 
27 {
28  protected readonly ‪Connection ‪$connection;
29 
30  public function ‪__construct(‪ConnectionPool $connectionPool)
31  {
32  $this->connection = $connectionPool->‪getConnectionForTable('fe_groups');
33  }
34 
35  public function ‪findRedirectPageIdByGroupId(int $groupId): ?int
36  {
37  $queryBuilder = $this->connection->createQueryBuilder();
38  $queryBuilder->getRestrictions()->removeAll();
39  $query = $queryBuilder
40  ->select('felogin_redirectPid')
41  ->from('fe_groups')
42  ->where(
43  $queryBuilder->expr()->neq('felogin_redirectPid', $this->connection->quote('')),
44  $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($groupId, ‪Connection::PARAM_INT))
45  )
46  ->setMaxResults(1);
47  $column = $query->executeQuery()->fetchOne();
48  return $column === false ? null : (int)$column;
49  }
50 }
‪TYPO3\CMS\Core\Database\Connection\PARAM_INT
‪const PARAM_INT
Definition: Connection.php:52
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository\__construct
‪__construct(ConnectionPool $connectionPool)
Definition: FrontendUserGroupRepository.php:30
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository\$connection
‪readonly Connection $connection
Definition: FrontendUserGroupRepository.php:28
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository\findRedirectPageIdByGroupId
‪findRedirectPageIdByGroupId(int $groupId)
Definition: FrontendUserGroupRepository.php:35
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:41
‪TYPO3\CMS\Core\Database\ConnectionPool\getConnectionForTable
‪getConnectionForTable(string $tableName)
Definition: ConnectionPool.php:82
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository
Definition: FrontendUserGroupRepository.php:27
‪TYPO3\CMS\FrontendLogin\Domain\Repository
Definition: FrontendUserGroupRepository.php:18