Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.1', '8.2', '8.3' ]
typo3: [ '11', '12' ]
php: [ '8.2', '8.3', '8.4' ]
typo3: [ '12', '13' ]
steps:
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-composer-
- run: rm composer.lock
- run: composer require typo3/minimal="^${{ matrix.typo3 }}" --dev --ignore-platform-req=php+
- run: composer install --no-interaction --no-progress --ignore-platform-req=php+
- run: ./vendor/bin/grumphp run --ansi
24 changes: 13 additions & 11 deletions Classes/DataProcessing/RelationProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;

final class RelationProcessor implements DataProcessorInterface
final readonly class RelationProcessor implements DataProcessorInterface
{
public function __construct(
private readonly ConnectionPool $connectionPool,
private readonly ContentDataProcessor $contentDataProcessor
private ConnectionPool $connectionPool,
private ContentDataProcessor $contentDataProcessor
) {
}

Expand All @@ -42,7 +42,8 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu

foreach ($relations as $key => $record) {
$recordContentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$recordContentObjectRenderer->start($record, $GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table'], $request);
$recordContentObjectRenderer->setRequest($request);
$recordContentObjectRenderer->start($record, $GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table']);
$processedRecordVariables[$key] = ['data' => $record];
$processedRecordVariables[$key] = $this->contentDataProcessor->process(
$recordContentObjectRenderer,
Expand All @@ -61,10 +62,11 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
public function getRelation(ContentObjectRenderer $cObj, string $table, string $field, int $uid): array
{
$tcaConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config'] ?? throw new RuntimeException(
'TCA config for ' . $table . '.' . $field . ' not found'
'TCA config for ' . $table . '.' . $field . ' not found',
9447139781
);

$foreignTable = $tcaConfig['foreign_table'] ?? throw new RuntimeException('TCA config foreign_table not found');
$foreignTable = $tcaConfig['foreign_table'] ?? throw new RuntimeException('TCA config foreign_table not found', 4960954942);

if (isset($tcaConfig['foreign_field'])) {
$rows = $this->getRowsForeignField($tcaConfig, $foreignTable, $uid);
Expand All @@ -77,7 +79,7 @@ public function getRelation(ContentObjectRenderer $cObj, string $table, string $
$records = [];

$pageRepository = $cObj->getTypoScriptFrontendController()?->sys_page;
$pageRepository instanceof PageRepository ?: throw new RuntimeException('PageRepository not found');
$pageRepository instanceof PageRepository ?: throw new RuntimeException('PageRepository not found', 4904331429);

foreach ($rows as $row) {
// Versioning preview:
Expand Down Expand Up @@ -172,18 +174,18 @@ private function getRowsLocalField(array $tcaConfig, string $foreignTable, strin
private function getRowsMM(mixed $tcaConfig, mixed $foreignTable, int $uid): array
{
if (isset($tcaConfig['MM_hasUidField'])) {
throw new RuntimeException('TCA config MM_hasUidField not supported');
throw new RuntimeException('TCA config MM_hasUidField not supported', 5983628871);
}

if (isset($tcaConfig['MM_is_foreign'])) {
throw new RuntimeException('TCA config MM_is_foreign not supported');
throw new RuntimeException('TCA config MM_is_foreign not supported', 9865861365);
}

if (isset($tcaConfig['MM_oppositeUsage'])) {
throw new RuntimeException('TCA config MM_oppositeUsage not supported');
throw new RuntimeException('TCA config MM_oppositeUsage not supported', 5536564928);
}

$mmTable = $tcaConfig['MM'] ?? throw new RuntimeException('TCA config MM not found');
$mmTable = $tcaConfig['MM'] ?? throw new RuntimeException('TCA config MM not found', 3744368881);

$matchFields = $tcaConfig['MM_match_fields'] ?? [];

Expand Down
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
],
"type": "typo3-cms-extension",
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"typo3/cms-core": "^11.5 || ^12.0",
"typo3/cms-frontend": "^11.5 || ^12.0"
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"typo3/cms-core": "^12.4 || ^13.4",
"typo3/cms-frontend": "^12.4 || ^13.4"
},
"require-dev": {
"pluswerk/grumphp-config": "^6.9",
"saschaegerer/phpstan-typo3": "^1.8.2",
"ssch/typo3-rector": "^1.3.5"
"pluswerk/grumphp-config": "^7.2.0 || ^10.1.4",
"saschaegerer/phpstan-typo3": "^1.10.2 || ^2.1.1",
"ssch/typo3-rector": "*"
},
"autoload": {
"psr-4": {
Expand All @@ -28,7 +28,8 @@
"pluswerk/grumphp-config": true,
"typo3/class-alias-loader": true,
"typo3/cms-composer-installers": true
}
},
"lock": false
},
"extra": {
"typo3/cms": {
Expand Down
Loading