‪TYPO3CMS  11.5
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 
24 
29 {
33  protected ‪$connection;
34 
38  protected ‪$table;
39 
40  public function ‪__construct(‪UserService $userService)
41  {
42  $this->table = $userService->‪getFeUserGroupTable();
43  $this->connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->‪getTable());
44  }
45 
46  public function ‪getTable(): string
47  {
48  return ‪$this->table;
49  }
50 
51  public function ‪findRedirectPageIdByGroupId(int $groupId): ?int
52  {
53  $queryBuilder = $this->connection->createQueryBuilder();
54  $queryBuilder->getRestrictions()->removeAll();
55 
56  $query = $queryBuilder
57  ->select('felogin_redirectPid')
58  ->from($this->‪getTable())
59  ->where(
60  $queryBuilder->expr()->neq(
61  'felogin_redirectPid',
62  $this->connection->quote('')
63  ),
64  $queryBuilder->expr()->eq(
65  'uid',
66  $queryBuilder->createNamedParameter($groupId, ‪Connection::PARAM_INT)
67  )
68  )
69  ->setMaxResults(1)
70  ;
71 
72  $column = $query->executeQuery()->fetchOne();
73  return $column === false ? null : (int)$column;
74  }
75 }
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository\__construct
‪__construct(UserService $userService)
Definition: FrontendUserGroupRepository.php:38
‪TYPO3\CMS\Core\Database\Connection\PARAM_INT
‪const PARAM_INT
Definition: Connection.php:49
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository\$table
‪string $table
Definition: FrontendUserGroupRepository.php:36
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository\$connection
‪Connection $connection
Definition: FrontendUserGroupRepository.php:32
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository\findRedirectPageIdByGroupId
‪findRedirectPageIdByGroupId(int $groupId)
Definition: FrontendUserGroupRepository.php:49
‪TYPO3\CMS\FrontendLogin\Service\UserService
Definition: UserService.php:26
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository\getTable
‪getTable()
Definition: FrontendUserGroupRepository.php:44
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:38
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\FrontendLogin\Service\UserService\getFeUserGroupTable
‪getFeUserGroupTable()
Definition: UserService.php:62
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository
Definition: FrontendUserGroupRepository.php:29
‪TYPO3\CMS\FrontendLogin\Domain\Repository
Definition: FrontendUserGroupRepository.php:18