Skip to content

Commit

Permalink
[!!!][TASK] Remove custom solution for something the core already does
Browse files Browse the repository at this point in the history
The custom solution still threw PHP 8 related exceptions. 
This commit removes the custom solution in favour of the core solution to resolve file references.
This changes the type of the "processed(Assets|Images)" elements from an array to an object of type TYPO3\CMS\Core\Resource\FileReference.

This means that backend preview templates that accessed these files might have to be refactored.
  • Loading branch information
jschlier committed Sep 7, 2022
1 parent 7d703aa commit d0e24fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 84 deletions.
77 changes: 0 additions & 77 deletions Classes/Service/FilereferenceService.php

This file was deleted.

10 changes: 3 additions & 7 deletions Classes/Service/ListService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction;
use TYPO3\CMS\Core\Resource\FileRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class ListService
Expand Down Expand Up @@ -68,16 +69,11 @@ public static function resolveListitems(array &$row, $field = 'tx_listelements_l
->execute()
->fetchColumn(0);

$fileRepository = GeneralUtility::makeInstance(FileRepository::class);
foreach ($row[$returnAs] as $key => $item) {
foreach (explode(',', $filereferences) as $fieldname) {
$fieldname = trim($fieldname);
if ($item[$fieldname]) {
$row[$returnAs][$key]['processed' . ucfirst($fieldname)] = \B13\Listelements\Service\FilereferenceService::resolveFilereferences(
$fieldname,
'tx_listelements_item',
$item['uid']
);
}
$row[$returnAs][$key]['processed' . ucfirst($fieldname)] = $fileRepository->findByRelation('tx_listelements_item', $fieldname, $item['uid']);
}
}
}
Expand Down

0 comments on commit d0e24fb

Please sign in to comment.