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

FluidTYPO3 / flux / 27757675993

18 Jun 2026 11:55AM UTC coverage: 89.162% (-3.5%) from 92.646%
27757675993

push

github

NamelessCoder
[TASK] Address last phpstan warnings

6228 of 6985 relevant lines covered (89.16%)

40.84 hits per line

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

11.76
/Classes/Integration/Overrides/BackendLayoutView.php
1
<?php
2
namespace FluidTYPO3\Flux\Integration\Overrides;
3

4
/*
5
 * This file is part of the FluidTYPO3/Flux project under GPLv2 or later.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.md file that was distributed with this source code.
9
 */
10

11
use FluidTYPO3\Flux\Provider\Interfaces\GridProviderInterface;
12
use FluidTYPO3\Flux\Provider\ProviderResolver;
13
use FluidTYPO3\Flux\Utility\DoctrineQueryProxy;
14
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
15
use TYPO3\CMS\Core\Database\ConnectionPool;
16
use TYPO3\CMS\Core\Utility\GeneralUtility;
17

18
#[Autoconfigure(public: true)]
19
class BackendLayoutView
20
{
21
    protected ?GridProviderInterface $provider = null;
22
    protected array $record = [];
23

24
    public function __construct(private \TYPO3\CMS\Backend\View\BackendLayoutView $backendLayoutView)
25
    {
26
    }
×
27

28
    public function setProvider(GridProviderInterface $provider): void
29
    {
30
        $this->provider = $provider;
4✔
31
    }
32

33
    public function setRecord(array $record): void
34
    {
35
        $this->record = $record;
4✔
36
    }
37

38
    /**
39
     * @param int $pageId
40
     */
41
    public function getSelectedBackendLayout($pageId): ?array
42
    {
43
        // Delegate resolving of backend layout structure to the Provider, which will return a Grid, which can create
44
        // a full backend layout data array.
45
        if ($this->provider instanceof GridProviderInterface) {
×
46
            return $this->provider->getGrid($this->record)->buildExtendedBackendLayoutArray(
×
47
                $this->resolveParentRecordUid($this->record)
×
48
            );
×
49
        }
50
        return $this->backendLayoutView->getSelectedBackendLayout($pageId);
×
51
    }
52

53
    /**
54
     * Extracts the UID to use as parent UID, based on properties of the record
55
     * and composition of the values within it, to ensure an integer UID.
56
     */
57
    protected function resolveParentRecordUid(array $record): int
58
    {
59
        $uid = $record['l18n_parent'] ?: $record['uid'];
×
60
        if (is_array($uid)) {
×
61
            // The record was passed by a third-party integration which read the record from FormEngine's expanded
62
            // format which stores select-type fields such as the l18n_parent as array values. Extract it from there.
63
            return $uid = reset($uid);
×
64
        }
65
        return (int) $uid;
×
66
    }
67

68
    /**
69
     * @codeCoverageIgnore
70
     */
71
    protected function loadRecordFromTable(string $table, int $uid): ?array
72
    {
73
        /** @var ConnectionPool $connectionPool */
74
        $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
75
        $queryBuilder = $connectionPool->getQueryBuilderForTable($table);
76
        $query = $queryBuilder->select('*')
77
            ->from($table)
78
            ->where($queryBuilder->expr()->eq('uid', $uid));
79
        $query->getRestrictions()->removeAll();
80
        /** @var array[] $results */
81
        $results = DoctrineQueryProxy::fetchAllAssociative(DoctrineQueryProxy::executeQueryOnQueryBuilder($query));
82
        return $results[0] ?? null;
83
    }
84

85
    /**
86
     * @codeCoverageIgnore
87
     */
88
    protected function resolvePrimaryProviderForRecord(string $table, array $record): ?GridProviderInterface
89
    {
90
        /** @var ProviderResolver $providerResolver */
91
        $providerResolver = GeneralUtility::makeInstance(ProviderResolver::class);
92
        return $providerResolver->resolvePrimaryConfigurationProvider(
93
            $table,
94
            null,
95
            $record,
96
            null,
97
            [GridProviderInterface::class]
98
        );
99
    }
100

101
    public function addBackendLayoutItems(array &$parameters)
102
    {
103
        return $this->backendLayoutView->addBackendLayoutItems($parameters);
×
104
    }
105

106
    public function getSelectedCombinedIdentifier(int $pageId): string|false
107
    {
108
        return $this->getSelectedCombinedIdentifier($pageId);
×
109
    }
110

111
    public function colPosListItemProcFunc(array &$parameters): void
112
    {
113
        $this->backendLayoutView->colPosListItemProcFunc($parameters);
×
114
    }
115

116
    public function getBackendLayoutForPage(int $pageId): ?BackendLayout
117
    {
118
        return $this->backendLayoutView->getBackendLayoutForPage($pageId);
×
119
    }
120

121
    public function parseStructure(BackendLayout $backendLayout): array
122
    {
123
        return $this->backendLayoutView->parseStructure($backendLayout);
×
124
    }
125
}
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