diff --git a/Build/phpstan-baseline12.neon b/Build/phpstan-baseline12.neon index 6aee1e5..9266255 100644 --- a/Build/phpstan-baseline12.neon +++ b/Build/phpstan-baseline12.neon @@ -44,3 +44,37 @@ parameters: message: "#^Instanceof between array and TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface will always evaluate to false\\.$#" count: 1 path: ../Classes/Backend/Preview/StandardContentPreviewRenderer.php + - + message: "#^Call to method get\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface\\.$#" + count: 1 + path: ../Classes/Service/DatabaseRowService.php + + - + message: "#^Call to method getMainType\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface\\.$#" + count: 2 + path: ../Classes/Service/DatabaseRowService.php + + - + message: "#^Call to method getPid\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface\\.$#" + count: 1 + path: ../Classes/Service/DatabaseRowService.php + + - + message: "#^Call to method getRawRecord\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface\\.$#" + count: 1 + path: ../Classes/Service/DatabaseRowService.php + + - + message: "#^Call to method getUid\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface\\.$#" + count: 2 + path: ../Classes/Service/DatabaseRowService.php + + - + message: "#^Parameter \\#2 \\$idOrRow of method TYPO3\\\\CMS\\\\Core\\\\Authentication\\\\BackendUserAuthentication\\:\\:recordEditAccessInternals\\(\\) expects array\\|int, TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface given\\.$#" + count: 1 + path: ../Classes/Service/DatabaseRowService.php + + - + message: "#^Parameter \\$record of method B13\\\\Backendpreviews\\\\Service\\\\DatabaseRowService\\:\\:getAdditionalDataForView\\(\\) has invalid type TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface\\.$#" + count: 1 + path: ../Classes/Service/DatabaseRowService.php \ No newline at end of file diff --git a/Build/phpstan-baseline13.neon b/Build/phpstan-baseline13.neon index 40382ae..41978b7 100644 --- a/Build/phpstan-baseline13.neon +++ b/Build/phpstan-baseline13.neon @@ -9,3 +9,7 @@ parameters: message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Database\\\\Query\\\\QueryBuilder\\:\\:add\\(\\)\\.$#" count: 1 path: ../Classes/ViewHelpers/GetDatabaseRecordViewHelper.php + - + message: "#^Parameter \\#2 \\$row of method TYPO3\\\\CMS\\\\Core\\\\Authentication\\\\BackendUserAuthentication\\:\\:recordEditAccessInternals\\(\\) expects array, TYPO3\\\\CMS\\\\Core\\\\Domain\\\\RecordInterface given\\.$#" + count: 1 + path: ../Classes/Service/DatabaseRowService.php \ No newline at end of file diff --git a/Classes/Backend/Preview/StandardContentPreviewRenderer.php b/Classes/Backend/Preview/StandardContentPreviewRenderer.php index e1a579a..0d37168 100644 --- a/Classes/Backend/Preview/StandardContentPreviewRenderer.php +++ b/Classes/Backend/Preview/StandardContentPreviewRenderer.php @@ -32,6 +32,7 @@ public function renderPageModulePreviewContent(GridColumnItem $item): string $record = $item->getRecord(); $context = $item->getContext(); $contentPreview = GeneralUtility::makeInstance(ContentPreview::class); + // note: this is only v14 s. https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/14.0/Breaking-92434-UseRecordAPIInPageModulePreviewRendering.html if ($record instanceof RecordInterface) { $content = $contentPreview->render($record, $context); } else { diff --git a/Classes/Service/DatabaseRowService.php b/Classes/Service/DatabaseRowService.php index e6af81d..3be3385 100644 --- a/Classes/Service/DatabaseRowService.php +++ b/Classes/Service/DatabaseRowService.php @@ -16,14 +16,14 @@ use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Domain\RecordInterface; +use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Resource\FileReference; use TYPO3\CMS\Core\Resource\FileRepository; use TYPO3\CMS\Core\Service\FlexFormService; -use TYPO3\CMS\Core\SingletonInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -class DatabaseRowService implements SingletonInterface +class DatabaseRowService { protected FileRepository $fileRepository; @@ -35,7 +35,12 @@ public function __construct(FileRepository $fileRepository) public function getAdditionalDataForView(RecordInterface $record): array { $data = []; - if ($this->getBackendUser()->recordEditAccessInternals($record->getMainType(), $record)) { + if ((new Typo3Version())->getMajorVersion() < 14) { + $editAccess = $this->getBackendUser()->recordEditAccessInternals($record->getMainType(), $record->getRawRecord()->toArray()); + } else { + $editAccess = $this->getBackendUser()->recordEditAccessInternals($record->getMainType(), $record); + } + if ($editAccess) { $urlParameters = [ 'edit' => [ 'tt_content' => [