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

CPS-IT / personio-jobs / 15388375997

02 Jun 2025 09:09AM UTC coverage: 3.654% (+0.04%) from 3.61%
15388375997

push

github

web-flow
Merge pull request #228 from CPS-IT/task/drop-v11

[!!!][TASK] Drop support for TYPO3 v11.5

0 of 8 new or added lines in 5 files covered. (0.0%)

6 existing lines in 5 files now uncovered.

27 of 739 relevant lines covered (3.65%)

0.16 hits per line

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

0.0
/Classes/Hooks/DataHandlerHook.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "personio_jobs".
7
 *
8
 * Copyright (C) 2023 Elias Häußler <e.haeussler@familie-redlich.de>
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 CPSIT\Typo3PersonioJobs\Hooks;
25

26
use CPSIT\Typo3PersonioJobs\Cache\CacheManager;
27
use CPSIT\Typo3PersonioJobs\Domain\Model\Job;
28
use CPSIT\Typo3PersonioJobs\Domain\Model\JobDescription;
29
use CPSIT\Typo3PersonioJobs\Domain\Repository\JobRepository;
30
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
31
use TYPO3\CMS\Core\DataHandling\DataHandler;
32
use TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface;
33

34
/**
35
 * DataHandlerHook
36
 *
37
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
38
 * @license GPL-2.0-or-later
39
 */
40
#[Autoconfigure(public: true)]
41
final readonly class DataHandlerHook
42
{
43
    public function __construct(
×
44
        private CacheManager $cacheManager,
45
        private JobRepository $jobRepository,
46
        private PersistenceManagerInterface $persistenceManager,
UNCOV
47
    ) {}
×
48

49
    /**
50
     * @param array<string, mixed> $fieldArray
51
     */
52
    public function processDatamap_afterDatabaseOperations(
×
53
        string $status,
54
        string $table,
55
        string|int $id,
56
        array $fieldArray,
57
        DataHandler $dataHandler,
58
    ): void {
59
        $uid = (int)(is_numeric($id) ? $id : $dataHandler->substNEWwithIDs[$id]);
×
60

61
        // Fetch job
62
        if ($table === JobDescription::TABLE_NAME) {
×
63
            $job = $this->jobRepository->findOneByJobDescription($uid);
×
64
        } elseif ($table === Job::TABLE_NAME) {
×
65
            $job = $this->jobRepository->findByUid($uid);
×
66
        } else {
67
            // Early return if current table is not supported
68
            return;
×
69
        }
70

71
        // Early return if job cannot be found
72
        if ($job === null) {
×
73
            return;
×
74
        }
75

76
        // Recalculate content hash
77
        $originalHash = $job->getContentHash();
×
78
        $job->recalculateContentHash();
×
79
        $updatedHash = $job->getContentHash();
×
80

81
        // Update job if hash changed
82
        if ($originalHash !== $updatedHash) {
×
83
            $this->persistenceManager->update($job);
×
84
            $this->cacheManager->flushTag($job);
×
85
            $this->cacheManager->flushTag();
×
86
        }
87
    }
88

89
    public function __destruct()
×
90
    {
91
        $this->persistenceManager->persistAll();
×
92
    }
93
}
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

© 2026 Coveralls, Inc