‪TYPO3CMS  10.4
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 
55  public function ‪findRedirectPageIdByGroupId(int $groupId): ?int
56  {
57  $queryBuilder = $this->connection->createQueryBuilder();
58  $queryBuilder->getRestrictions()->removeAll();
59 
60  $query = $queryBuilder
61  ->select('felogin_redirectPid')
62  ->from($this->‪getTable())
63  ->where(
64  $queryBuilder->expr()->neq(
65  'felogin_redirectPid',
66  $this->connection->quote('')
67  ),
68  $queryBuilder->expr()->eq(
69  'uid',
70  $queryBuilder->createNamedParameter($groupId, ‪Connection::PARAM_INT)
71  )
72  )
73  ->setMaxResults(1)
74  ;
75 
76  $column = $query->execute()->fetchColumn();
77  return $column === false ? null : (int)$column;
78  }
79 }
‪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:47
‪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
‪int null findRedirectPageIdByGroupId(int $groupId)
Definition: FrontendUserGroupRepository.php:53
‪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:36
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\FrontendLogin\Service\UserService\getFeUserGroupTable
‪getFeUserGroupTable()
Definition: UserService.php:66
‪TYPO3\CMS\FrontendLogin\Domain\Repository\FrontendUserGroupRepository
Definition: FrontendUserGroupRepository.php:29
‪TYPO3\CMS\FrontendLogin\Domain\Repository
Definition: FrontendUserGroupRepository.php:18