• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eliashaeussler / typo3-form-consent / 9326996048

01 Jun 2024 02:46AM UTC coverage: 95.438%. Remained the same
9326996048

push

github

web-flow
[TASK] Update all dependencies

774 of 811 relevant lines covered (95.44%)

14.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/Classes/Domain/Repository/ConsentRepository.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "form_consent".
7
 *
8
 * Copyright (C) 2021-2024 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\Typo3FormConsent\Domain\Repository;
25

26
use EliasHaeussler\Typo3FormConsent\Domain;
27
use TYPO3\CMS\Core;
28
use TYPO3\CMS\Extbase;
29

30
/**
31
 * ConsentRepository
32
 *
33
 * @author Elias Häußler <elias@haeussler.dev>
34
 * @license GPL-2.0-or-later
35
 *
36
 * @extends Extbase\Persistence\Repository<Domain\Model\Consent>
37
 */
38
class ConsentRepository extends Extbase\Persistence\Repository
39
{
40
    public function initializeObject(): void
20✔
41
    {
42
        $querySettings = Core\Utility\GeneralUtility::makeInstance(Extbase\Persistence\Generic\Typo3QuerySettings::class);
20✔
43
        $querySettings->setRespectStoragePage(false);
20✔
44
        $this->setDefaultQuerySettings($querySettings);
20✔
45
    }
46

47
    public function findOneByValidationHash(string $validationHash): ?Domain\Model\Consent
20✔
48
    {
49
        $query = $this->createQuery();
20✔
50
        $query->matching(
20✔
51
            $query->logicalAnd(
20✔
52
                $query->equals('validation_hash', $validationHash),
20✔
53
                $query->logicalOr(
20✔
54
                    $query->equals('valid_until', null),
20✔
55
                    $query->greaterThanOrEqual('valid_until', time()),
20✔
56
                ),
20✔
57
            ),
20✔
58
        );
20✔
59
        /** @var Domain\Model\Consent|null $consent */
60
        $consent = $query->execute()->getFirst();
20✔
61

62
        return $consent;
20✔
63
    }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc