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

Yoast / Yoast-SEO-for-TYPO3 / 24723291290

21 Apr 2026 12:50PM UTC coverage: 10.457% (+9.2%) from 1.275%
24723291290

push

github

web-flow
Merge pull request #632 from Yoast/feature/yoast-v12

[FEATURE] Version 12.0.0, added v14 support, removed v11 support including php8.0 and php8.1, rewrote backend javascript functionality to typescript and webcomponents

40 of 806 new or added lines in 69 files covered. (4.96%)

40 existing lines in 23 files now uncovered.

284 of 2716 relevant lines covered (10.46%)

0.29 hits per line

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

0.0
/Classes/Record/RecordService.php
1
<?php
2

3
/**
4
 * This file is part of the "yoast_seo" extension for TYPO3 CMS.
5
 *
6
 * For the full copyright and license information, please read the
7
 * LICENSE.txt file that was distributed with this source code.
8
 */
9

10
declare(strict_types=1);
11

12
namespace YoastSeoForTypo3\YoastSeo\Record;
13

14
use TYPO3\CMS\Core\Database\ConnectionPool;
15
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
16
use TYPO3\CMS\Core\SingletonInterface;
17
use TYPO3\CMS\Core\Utility\ArrayUtility;
18
use TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException;
19

20
class RecordService implements SingletonInterface
21
{
22
    protected bool $recordsChecked = false;
23
    protected ?Record $activeRecord = null;
24

25
    public function __construct(
26
        protected readonly ConnectionPool $connectionPool,
27
        protected readonly PageRepository $pageRepository
NEW
28
    ) {}
×
29

30
    public function getActiveRecord(): ?Record
31
    {
32
        if ($this->recordsChecked) {
×
33
            return $this->activeRecord;
×
34
        }
35

36
        $records = RecordRegistry::getInstance()->getRecords(true);
×
37
        if (empty($records)) {
×
38
            $this->recordsChecked = true;
×
39
            return null;
×
40
        }
41

42
        $this->activeRecord = $this->findRecord($records);
×
43
        if ($this->activeRecord instanceof Record) {
×
44
            $recordData = $this->getRecordData($this->activeRecord);
×
45
            $this->activeRecord->setRecordData($recordData);
×
46
        }
47

48
        $this->recordsChecked = true;
×
49
        return $this->activeRecord;
×
50
    }
51

52
    /**
53
     * @param Record[] $records
54
     * @return Record|null
55
     */
56
    protected function findRecord(array $records): ?Record
57
    {
NEW
58
        $currentGetParameters = ($GLOBALS['TYPO3_REQUEST'] ?? null)?->getQueryParams() ?? [];
×
59

60
        foreach ($records as $record) {
×
61
            if (empty($record->getGetParameters())) {
×
62
                continue;
×
63
            }
64

65
            foreach ($record->getGetParameters() as $getParameters) {
×
66
                try {
67
                    $getValue = ArrayUtility::getValueByPath($currentGetParameters, implode('/', $getParameters));
×
NEW
68
                } catch (MissingArrayPathException) {
×
69
                    $getValue = null;
×
70
                }
71
                if ($getValue !== null) {
×
72
                    $record->setRecordUid((int)$getValue);
×
73
                    return $record;
×
74
                }
75
            }
76
        }
77

78
        return null;
×
79
    }
80

81
    /**
82
     * @return array<string, mixed>
83
     */
84
    protected function getRecordData(Record $record): array
85
    {
NEW
86
        $recordRow = $this->connectionPool
×
87
            ->getConnectionForTable($record->getTableName())
×
88
            ->select(['*'], $record->getTableName(), ['uid' => $record->getRecordUid()])
×
89
            ->fetchAssociative();
×
90

NEW
91
        return (array)$this->pageRepository->getLanguageOverlay($record->getTableName(), (array)$recordRow);
×
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