From 95c45467cc21c64c34e758877264bc0a13304e73 Mon Sep 17 00:00:00 2001 From: Fabien Udriot Date: Sat, 6 Sep 2025 14:37:58 +0200 Subject: [PATCH 01/11] [TASK] Remove v11 legacy code --- Classes/Command/VidiCommand.php | 72 ---- Classes/Controller/ContentController.php | 13 +- .../Domain/Repository/ContentRepository.php | 67 ++-- Classes/Domain/Validator/ColumnsValidator.php | 4 +- Classes/Domain/Validator/FacetValidator.php | 4 +- Classes/Domain/Validator/MatchesValidator.php | 4 +- Classes/Domain/Validator/ToolValidator.php | 4 +- Classes/Persistence/MatcherObjectFactory.php | 13 +- Classes/Persistence/Query.php | 76 ++-- Classes/Service/ContentService.php | 13 +- Classes/Tca/Tca.php | 21 +- .../Content/AbstractContentViewHelper.php | 43 ++- Configuration/TCA/Overrides/fe_groups.php | 67 ---- Configuration/TCA/Overrides/fe_users.php | 119 ------- Configuration/TCA/Overrides/tt_content.php | 58 ---- Configuration/TCA/tx_vidi_selection.php | 92 ----- ext_localconf.php | 58 ++-- ext_tables.php | 326 +++++++++--------- ext_typoscript_setup.txt | 15 - mod/content/conf.php | 5 - 20 files changed, 318 insertions(+), 756 deletions(-) delete mode 100644 Classes/Command/VidiCommand.php delete mode 100644 Configuration/TCA/Overrides/fe_groups.php delete mode 100644 Configuration/TCA/Overrides/fe_users.php delete mode 100644 Configuration/TCA/Overrides/tt_content.php delete mode 100644 Configuration/TCA/tx_vidi_selection.php delete mode 100644 ext_typoscript_setup.txt delete mode 100644 mod/content/conf.php diff --git a/Classes/Command/VidiCommand.php b/Classes/Command/VidiCommand.php deleted file mode 100644 index a0ca2d7..0000000 --- a/Classes/Command/VidiCommand.php +++ /dev/null @@ -1,72 +0,0 @@ -setDescription('Check TCA configuration for relations used in grid.') - ->addOption( - 'table', - 'c', - InputOption::VALUE_NONE, - 'The table name. If not defined check for every table.' - ); - } - - /** - * @param InputInterface $input - * @param OutputInterface $output - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $io = new SymfonyStyle($input, $output); - foreach ($GLOBALS['TCA'] as $tableName => $TCA) { - $table = $input->getOption('table'); - if ($table !== '' && $table !== $tableName) { - continue; - } - - $fields = Tca::grid($tableName)->getFields(); - if (!empty($fields)) { - $relations = $this->getGridAnalyserService()->checkRelationForTable($tableName); - if (!empty($relations)) { - $io->text(sprintf('Relations for "%s"', $tableName)); - $io->text(implode("\n", $relations)); - } - } - } - } - - /** - * Get the Vidi Module Loader. - * - * @return GridAnalyserService|object - */ - protected function getGridAnalyserService() - { - return GeneralUtility::makeInstance(GridAnalyserService::class); - } -} diff --git a/Classes/Controller/ContentController.php b/Classes/Controller/ContentController.php index a155f96..c6921f5 100644 --- a/Classes/Controller/ContentController.php +++ b/Classes/Controller/ContentController.php @@ -37,7 +37,6 @@ use Fab\Vidi\Persistence\PagerObjectFactory; use Fab\Vidi\Signal\ProcessContentDataSignalArguments; use Fab\Vidi\Tca\Tca; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; /** * Controller which handles actions related to Vidi in the Backend. @@ -724,7 +723,7 @@ protected function emitProcessContentDataSignal(Content $contentObject, $fieldNa ->setSavingBehavior($savingBehavior) ->setLanguage($language); - $signalResult = $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\Controller\Backend\ContentController', 'processContentData', array($signalArguments)); + #$signalResult = $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\Controller\Backend\ContentController', 'processContentData', array($signalArguments)); return $signalResult[0]; } @@ -733,10 +732,10 @@ protected function emitProcessContentDataSignal(Content $contentObject, $fieldNa * * @return Dispatcher */ - protected function getSignalSlotDispatcher() - { - return GeneralUtility::makeInstance(Dispatcher::class); - } +// protected function getSignalSlotDispatcher() +// { +// return GeneralUtility::makeInstance(Dispatcher::class); +// } /** * Get the Clipboard service. @@ -770,4 +769,4 @@ public function injectSelectionRepository(SelectionRepository $selectionReposito { $this->selectionRepository = $selectionRepository; } -} +} \ No newline at end of file diff --git a/Classes/Domain/Repository/ContentRepository.php b/Classes/Domain/Repository/ContentRepository.php index 7ce0d20..fc6f0fd 100644 --- a/Classes/Domain/Repository/ContentRepository.php +++ b/Classes/Domain/Repository/ContentRepository.php @@ -31,7 +31,6 @@ use Fab\Vidi\Persistence\Query; use Fab\Vidi\Tca\Tca; use TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; /** * Repository for accessing Content @@ -611,7 +610,7 @@ protected function computeConstraints(Query $query, Matcher $matcher): ?Constrai } // Trigger signal for post processing the computed constraints object. - $constraints = $this->emitPostProcessConstraintsSignal($query, $constraints); + #$constraints = $this->emitPostProcessConstraintsSignal($query, $constraints); return $constraints; } @@ -830,35 +829,35 @@ protected function getLanguageValidator(): LanguageValidator * @param ConstraintInterface|null $constraints * @return ConstraintInterface|null $constraints */ - protected function emitPostProcessConstraintsSignal(Query $query, $constraints): ?ConstraintInterface - { - /** @var ConstraintContainer $constraintContainer */ - $constraintContainer = GeneralUtility::makeInstance(ConstraintContainer::class); - $result = $this->getSignalSlotDispatcher()->dispatch( - self::class, - 'postProcessConstraintsObject', - [ - $query, - $constraints, - $constraintContainer - ] - ); - - // Backward compatibility. - $processedConstraints = $result[1]; - - // New way to transmit the constraints. - if ($constraintContainer->getConstraint()) { - $processedConstraints = $constraintContainer->getConstraint(); - } - return $processedConstraints; - } - - /** - * @return Dispatcher - */ - protected function getSignalSlotDispatcher(): Dispatcher - { - return GeneralUtility::makeInstance(Dispatcher::class); - } -} +// protected function emitPostProcessConstraintsSignal(Query $query, $constraints): ?ConstraintInterface +// { +// /** @var ConstraintContainer $constraintContainer */ +// $constraintContainer = GeneralUtility::makeInstance(ConstraintContainer::class); +// $result = $this->getSignalSlotDispatcher()->dispatch( +// self::class, +// 'postProcessConstraintsObject', +// [ +// $query, +// $constraints, +// $constraintContainer +// ] +// ); +// +// // Backward compatibility. +// $processedConstraints = $result[1]; +// +// // New way to transmit the constraints. +// if ($constraintContainer->getConstraint()) { +// $processedConstraints = $constraintContainer->getConstraint(); +// } +// return $processedConstraints; +// } +// +// /** +// * @return Dispatcher +// */ +// protected function getSignalSlotDispatcher(): Dispatcher +// { +// return GeneralUtility::makeInstance(Dispatcher::class); +// } +} \ No newline at end of file diff --git a/Classes/Domain/Validator/ColumnsValidator.php b/Classes/Domain/Validator/ColumnsValidator.php index a23f3e7..c7a6a66 100644 --- a/Classes/Domain/Validator/ColumnsValidator.php +++ b/Classes/Domain/Validator/ColumnsValidator.php @@ -23,7 +23,7 @@ class ColumnsValidator extends AbstractValidator * @param mixed $columns * @return void */ - public function isValid($columns) + public function isValid($columns): void { foreach ($columns as $columnName) { if (!Tca::grid()->hasField($columnName)) { @@ -32,4 +32,4 @@ public function isValid($columns) } } } -} +} \ No newline at end of file diff --git a/Classes/Domain/Validator/FacetValidator.php b/Classes/Domain/Validator/FacetValidator.php index 355329f..8b0a058 100644 --- a/Classes/Domain/Validator/FacetValidator.php +++ b/Classes/Domain/Validator/FacetValidator.php @@ -23,11 +23,11 @@ class FacetValidator extends AbstractValidator * @param mixed $facet * @return void */ - public function isValid($facet) + public function isValid($facet): void { if (!Tca::grid()->hasFacet($facet)) { $message = sprintf('Facet "%s" is not allowed. Actually, it was not configured to be displayed in the grid.', $facet); $this->addError($message, 1380019719); } } -} +} \ No newline at end of file diff --git a/Classes/Domain/Validator/MatchesValidator.php b/Classes/Domain/Validator/MatchesValidator.php index d95e7ba..e1f3af0 100644 --- a/Classes/Domain/Validator/MatchesValidator.php +++ b/Classes/Domain/Validator/MatchesValidator.php @@ -23,7 +23,7 @@ class MatchesValidator extends AbstractValidator * @param mixed $matches * @return void */ - public function isValid($matches) + public function isValid($matches): void { foreach ($matches as $fieldName => $value) { if (!Tca::table()->hasField($fieldName)) { @@ -32,4 +32,4 @@ public function isValid($matches) } } } -} +} \ No newline at end of file diff --git a/Classes/Domain/Validator/ToolValidator.php b/Classes/Domain/Validator/ToolValidator.php index 76ba7d1..dbdb6d2 100644 --- a/Classes/Domain/Validator/ToolValidator.php +++ b/Classes/Domain/Validator/ToolValidator.php @@ -24,7 +24,7 @@ class ToolValidator extends AbstractValidator * @param string $tool * @return void */ - public function isValid($tool) + public function isValid($tool): void { $dataType = $this->getModuleLoader()->getDataType(); $isValid = ToolRegistry::getInstance()->isAllowed($dataType, $tool); @@ -49,4 +49,4 @@ protected function getModuleLoader() { return GeneralUtility::makeInstance(ModuleLoader::class); } -} +} \ No newline at end of file diff --git a/Classes/Persistence/MatcherObjectFactory.php b/Classes/Persistence/MatcherObjectFactory.php index 16d8356..66f8043 100644 --- a/Classes/Persistence/MatcherObjectFactory.php +++ b/Classes/Persistence/MatcherObjectFactory.php @@ -19,7 +19,6 @@ use TYPO3\CMS\Core\Utility\MathUtility; use Fab\Vidi\Module\ModuleLoader; use Fab\Vidi\Tca\Tca; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; /** * Factory class related to Matcher object. @@ -229,7 +228,7 @@ protected function emitPostProcessMatcherObjectSignal(Matcher $matcher): void $matcher->setDataType($moduleLoader->getDataType()); } - $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\Controller\Backend\ContentController', 'postProcessMatcherObject', array($matcher, $matcher->getDataType())); + #$this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\Controller\Backend\ContentController', 'postProcessMatcherObject', array($matcher, $matcher->getDataType())); } /** @@ -237,10 +236,10 @@ protected function emitPostProcessMatcherObjectSignal(Matcher $matcher): void * * @return Dispatcher|object */ - protected function getSignalSlotDispatcher() - { - return GeneralUtility::makeInstance(Dispatcher::class); - } +// protected function getSignalSlotDispatcher() +// { +// return GeneralUtility::makeInstance(Dispatcher::class); +// } /** * Get the Vidi Module Loader. @@ -274,4 +273,4 @@ protected function isBackendMode(): bool { return Typo3Mode::isBackendMode(); } -} +} \ No newline at end of file diff --git a/Classes/Persistence/Query.php b/Classes/Persistence/Query.php index f816d53..e6410e4 100644 --- a/Classes/Persistence/Query.php +++ b/Classes/Persistence/Query.php @@ -196,12 +196,23 @@ public function getType() return $this->type; } + /** + * Sets the type this query cares for. + * + * @param string $type + * @return void + */ + public function setType($type): void + { + $this->type = $type; + } + /** * Sets the source to fetch the result from * * @param SourceInterface $source */ - public function setSource(SourceInterface $source) + public function setSource(SourceInterface $source): void { $this->source = $source; } @@ -226,7 +237,7 @@ protected function getSelectorName() * * @return SourceInterface the node-tuple source; non-null */ - public function getSource() + public function getSource(): SourceInterface { if ($this->source === null) { $this->source = $this->qomFactory->selector($this->getType()); @@ -240,7 +251,7 @@ public function getSource() * @return QueryResultInterface|array The query result object or an array if $this->getQuerySettings()->getReturnRawQueryResult() is true * @api */ - public function execute($returnRawQueryResult = false) + public function execute($returnRawQueryResult = false): QueryResultInterface|array { /** @var VidiDbBackend $backend */ $backend = GeneralUtility::makeInstance(VidiDbBackend::class, $this); @@ -259,7 +270,7 @@ public function execute($returnRawQueryResult = false) * @return QueryInterface * @api */ - public function setOrderings(array $orderings) + public function setOrderings(array $orderings): QueryInterface { $this->orderings = $orderings; return $this; @@ -376,26 +387,19 @@ public function getConstraint() } /** - * Performs a logical conjunction of the given constraints. The method takes one or more contraints and concatenates them with a boolean AND. - * It also scepts a single array of constraints to be concatenated. + * Performs a logical conjunction of the given constraints. The method takes one or more constraints and concatenates them with a boolean AND. * - * @param mixed $constraint1 The first of multiple constraints or an array of constraints. + * @param ConstraintInterface ...$constraints One or more constraints. * @throws InvalidNumberOfConstraintsException * @return AndInterface * @api */ - public function logicalAnd($constraint1) + public function logicalAnd(ConstraintInterface ...$constraints): AndInterface { - if (is_array($constraint1)) { - $resultingConstraint = array_shift($constraint1); - $constraints = $constraint1; - } else { - $constraints = func_get_args(); - $resultingConstraint = array_shift($constraints); - } - if ($resultingConstraint === null) { - throw new InvalidNumberOfConstraintsException('There must be at least one constraint or a non-empty array of constraints given.', 1401289500); + if (count($constraints) === 0) { + throw new InvalidNumberOfConstraintsException('There must be at least one constraint given.', 1401289500); } + $resultingConstraint = array_shift($constraints); foreach ($constraints as $constraint) { $resultingConstraint = $this->qomFactory->_and($resultingConstraint, $constraint); } @@ -403,25 +407,19 @@ public function logicalAnd($constraint1) } /** - * Performs a logical disjunction of the two given constraints + * Performs a logical disjunction of the given constraints. The method takes one or more constraints and concatenates them with a boolean OR. * - * @param mixed $constraint1 The first of multiple constraints or an array of constraints. + * @param ConstraintInterface ...$constraints One or more constraints. * @throws InvalidNumberOfConstraintsException * @return OrInterface * @api */ - public function logicalOr($constraint1) + public function logicalOr(ConstraintInterface ...$constraints): OrInterface { - if (is_array($constraint1)) { - $resultingConstraint = array_shift($constraint1); - $constraints = $constraint1; - } else { - $constraints = func_get_args(); - $resultingConstraint = array_shift($constraints); - } - if ($resultingConstraint === null) { - throw new InvalidNumberOfConstraintsException('There must be at least one constraint or a non-empty array of constraints given.', 1401289501); + if (count($constraints) === 0) { + throw new InvalidNumberOfConstraintsException('There must be at least one constraint given.', 1401289501); } + $resultingConstraint = array_shift($constraints); foreach ($constraints as $constraint) { $resultingConstraint = $this->qomFactory->_or($resultingConstraint, $constraint); } @@ -436,7 +434,7 @@ public function logicalOr($constraint1) * @return NotInterface * @api */ - public function logicalNot(ConstraintInterface $constraint) + public function logicalNot(ConstraintInterface $constraint): NotInterface { return $this->qomFactory->not($constraint); } @@ -450,7 +448,7 @@ public function logicalNot(ConstraintInterface $constraint) * @return ComparisonInterface * @api */ - public function equals($propertyName, $operand, $caseSensitive = true) + public function equals($propertyName, $operand, $caseSensitive = true): ComparisonInterface { if (is_object($operand) || $caseSensitive) { $comparison = $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_EQUAL_TO, $operand); @@ -469,7 +467,7 @@ public function equals($propertyName, $operand, $caseSensitive = true) * @return ComparisonInterface * @api */ - public function like($propertyName, $operand, $caseSensitive = true) + public function like($propertyName, $operand, $caseSensitive = true): ComparisonInterface { return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_LIKE, $operand); } @@ -483,7 +481,7 @@ public function like($propertyName, $operand, $caseSensitive = true) * @return ComparisonInterface * @api */ - public function contains($propertyName, $operand) + public function contains($propertyName, $operand): ComparisonInterface { return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_CONTAINS, $operand); } @@ -498,7 +496,7 @@ public function contains($propertyName, $operand) * @return ComparisonInterface * @api */ - public function in($propertyName, $operand) + public function in($propertyName, $operand): ComparisonInterface { if (!is_array($operand) && !$operand instanceof \ArrayAccess && !$operand instanceof \Traversable) { throw new UnexpectedTypeException('The "in" operator must be given a mutlivalued operand (array, ArrayAccess, Traversable).', 1264678095); @@ -514,7 +512,7 @@ public function in($propertyName, $operand) * @return ComparisonInterface * @api */ - public function lessThan($propertyName, $operand) + public function lessThan($propertyName, $operand): ComparisonInterface { return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_LESS_THAN, $operand); } @@ -553,7 +551,7 @@ public function greaterThan($propertyName, $operand) * @return ComparisonInterface * @api */ - public function greaterThanOrEqual($propertyName, $operand) + public function greaterThanOrEqual($propertyName, $operand): ComparisonInterface { return $this->qomFactory->comparison($this->qomFactory->propertyValue($propertyName, $this->getSelectorName()), QueryInterface::OPERATOR_GREATER_THAN_OR_EQUAL_TO, $operand); } @@ -650,13 +648,13 @@ public function setSourceFieldName($sourceFieldName) return $this; } - public function setQuerySettings(QuerySettingsInterface $querySettings) + public function setQuerySettings(QuerySettingsInterface $querySettings): void { $this->typo3QuerySettings = $querySettings; } - public function getQuerySettings() + public function getQuerySettings(): QuerySettingsInterface { return $this->typo3QuerySettings; } -} +} \ No newline at end of file diff --git a/Classes/Service/ContentService.php b/Classes/Service/ContentService.php index ac44bf3..d85a1a5 100644 --- a/Classes/Service/ContentService.php +++ b/Classes/Service/ContentService.php @@ -15,7 +15,6 @@ use Fab\Vidi\Persistence\Matcher; use Fab\Vidi\Persistence\Order; use Fab\Vidi\Signal\AfterFindContentObjectsSignalArguments; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; /** * File References service. @@ -100,7 +99,7 @@ protected function emitAfterFindContentObjectsSignal($contentObjects, Matcher $m ->setOffset($offset) ->setHasBeenProcessed(false); - $signalResult = $this->getSignalSlotDispatcher()->dispatch(ContentService::class, 'afterFindContentObjects', array($signalArguments)); + #$signalResult = $this->getSignalSlotDispatcher()->dispatch(ContentService::class, 'afterFindContentObjects', array($signalArguments)); return $signalResult[0]; } @@ -119,10 +118,10 @@ protected function getModuleLoader() * * @return Dispatcher|object */ - protected function getSignalSlotDispatcher() - { - return GeneralUtility::makeInstance(Dispatcher::class); - } +// protected function getSignalSlotDispatcher() +// { +// return GeneralUtility::makeInstance(Dispatcher::class); +// } /** * @return Content[] @@ -139,4 +138,4 @@ public function getNumberOfObjects() { return $this->numberOfObjects; } -} +} \ No newline at end of file diff --git a/Classes/Tca/Tca.php b/Classes/Tca/Tca.php index 2ed9d82..0503824 100644 --- a/Classes/Tca/Tca.php +++ b/Classes/Tca/Tca.php @@ -18,7 +18,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use Fab\Vidi\Domain\Model\Content; use Fab\Vidi\Exception\NotExistingClassException; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; /** * A class to handle TCA ctrl. @@ -79,7 +78,7 @@ protected static function getService($dataType, $serviceType) $className = sprintf('Fab\Vidi\Tca\%sService', ucfirst($serviceType)); // Signal to pre-process the TCA of the given $dataType. - self::emitPreProcessTcaSignal($dataType, $serviceType); + #self::emitPreProcessTcaSignal($dataType, $serviceType); $instance = GeneralUtility::makeInstance($className, $dataType, $serviceType); self::$instances[$dataType][$serviceType] = $instance; @@ -138,10 +137,10 @@ public static function getSystemFields() * @throws InvalidSlotReturnException * @throws \InvalidArgumentException */ - protected static function emitPreProcessTcaSignal($dataType, $serviceType) - { - self::getSignalSlotDispatcher()->dispatch(Tca::class, 'preProcessTca', array($dataType, $serviceType)); - } +// protected static function emitPreProcessTcaSignal($dataType, $serviceType) +// { +// self::getSignalSlotDispatcher()->dispatch(Tca::class, 'preProcessTca', array($dataType, $serviceType)); +// } /** * Get the SignalSlot dispatcher @@ -149,8 +148,8 @@ protected static function emitPreProcessTcaSignal($dataType, $serviceType) * @return Dispatcher * @throws \InvalidArgumentException */ - protected static function getSignalSlotDispatcher() - { - return GeneralUtility::makeInstance(Dispatcher::class); - } -} +// protected static function getSignalSlotDispatcher() +// { +// return GeneralUtility::makeInstance(Dispatcher::class); +// } +} \ No newline at end of file diff --git a/Classes/ViewHelpers/Content/AbstractContentViewHelper.php b/Classes/ViewHelpers/Content/AbstractContentViewHelper.php index 7e32a7b..2154a16 100644 --- a/Classes/ViewHelpers/Content/AbstractContentViewHelper.php +++ b/Classes/ViewHelpers/Content/AbstractContentViewHelper.php @@ -16,7 +16,6 @@ use Fab\Vidi\Persistence\ResultSetStorage; use Fab\Vidi\Resolver\FieldPathResolver; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; use Fab\Vidi\Persistence\Matcher; use Fab\Vidi\Persistence\Order; @@ -157,10 +156,10 @@ public function getResultSetStorage() * @param string $dataType * @param Order $order */ - protected function emitPostProcessOrderObjectSignal($dataType, Order $order) - { - $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessOrderObject', array($order, $dataType)); - } +// protected function emitPostProcessOrderObjectSignal($dataType, Order $order) +// { +// $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessOrderObject', array($order, $dataType)); +// } /** * Signal that is called for post-processing a "matcher" object. @@ -168,10 +167,10 @@ protected function emitPostProcessOrderObjectSignal($dataType, Order $order) * @param string $dataType * @param Matcher $matcher */ - protected function emitPostProcessMatcherObjectSignal($dataType, Matcher $matcher) - { - $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessMatcherObject', array($matcher, $dataType)); - } +// protected function emitPostProcessMatcherObjectSignal($dataType, Matcher $matcher) +// { +// $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessMatcherObject', array($matcher, $dataType)); +// } /** * Signal that is called for post-processing a "limit". @@ -179,10 +178,10 @@ protected function emitPostProcessMatcherObjectSignal($dataType, Matcher $matche * @param string $dataType * @param int $limit */ - protected function emitPostProcessLimitSignal($dataType, $limit) - { - $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessLimit', array($limit, $dataType)); - } +// protected function emitPostProcessLimitSignal($dataType, $limit) +// { +// $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessLimit', array($limit, $dataType)); +// } /** * Signal that is called for post-processing a "offset". @@ -190,20 +189,20 @@ protected function emitPostProcessLimitSignal($dataType, $limit) * @param string $dataType * @param int $offset */ - protected function emitPostProcessOffsetSignal($dataType, $offset) - { - $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessLimit', array($offset, $dataType)); - } +// protected function emitPostProcessOffsetSignal($dataType, $offset) +// { +// $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessLimit', array($offset, $dataType)); +// } /** * Get the SignalSlot dispatcher * * @return Dispatcher */ - protected function getSignalSlotDispatcher() - { - return GeneralUtility::makeInstance(Dispatcher::class); - } +// protected function getSignalSlotDispatcher() +// { +// return GeneralUtility::makeInstance(Dispatcher::class); +// } /** * @param $ignoreEnableFields @@ -224,4 +223,4 @@ protected function getFieldPathResolver() { return GeneralUtility::makeInstance(FieldPathResolver::class); } -} +} \ No newline at end of file diff --git a/Configuration/TCA/Overrides/fe_groups.php b/Configuration/TCA/Overrides/fe_groups.php deleted file mode 100644 index 304acdd..0000000 --- a/Configuration/TCA/Overrides/fe_groups.php +++ /dev/null @@ -1,67 +0,0 @@ - [ - // Special case when the field name does not follow the conventions. - // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. - 'mappings' => [ - 'lockToDomain' => 'lockToDomain', - 'TSconfig' => 'tsConfig', - 'felogin_redirectPid' => 'feLoginRedirectPid', - ], - ], - 'grid' => [ - 'facets' => [ - 'uid', - 'title', - 'description', - PageFacet::class => [ - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' - ] - ], - 'columns' => [ - '__checkbox' => [ - 'renderer' => CheckBoxRenderer::class, - ], - 'uid' => [ - 'visible' => false, - 'label' => 'Id', - 'width' => '5px', - ], - 'title' => [ - 'visible' => true, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf:title', - 'editable' => true, - ], - 'tstamp' => [ - 'visible' => false, - 'format' => 'Fab\Vidi\Formatter\Date', - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', - ], - 'crdate' => [ - 'visible' => false, - 'format' => 'Fab\Vidi\Formatter\Date', - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', - ], - #'hidden' => [ - # 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', - # 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:visibility_abbreviation', - # 'width' => '3%', - #], - '__buttons' => [ - 'renderer' => ButtonGroupRenderer::class, - ], - ] - ] -]; - -ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['fe_groups'], $tca); diff --git a/Configuration/TCA/Overrides/fe_users.php b/Configuration/TCA/Overrides/fe_users.php deleted file mode 100644 index a4b7ebd..0000000 --- a/Configuration/TCA/Overrides/fe_users.php +++ /dev/null @@ -1,119 +0,0 @@ - [ - // By default "searchFields" has many fields which has a performance cost when dealing with large data-set. - // Override search field for performance reason. - // To restore default values, just replace with this: $GLOBALS['TCA']['fe_users']['ctrl']['searchFields'] . ',usergroup', - 'searchFields' => 'username, first_name, last_name, usergroup', - ], - 'vidi' => [ - // Special case when the field name does not follow the conventions. - // Vidi needs a bit of help to find the equivalence fieldName <-> propertyName. - 'mappings' => [ - 'lockToDomain' => 'lockToDomain', - 'TSconfig' => 'tsConfig', - 'felogin_redirectPid' => 'feLoginRedirectPid', - 'felogin_forgotHash' => 'feLoginForgotHash', - ], - ], - 'grid' => [ - 'excluded_fields' => 'lockToDomain, TSconfig, felogin_redirectPid, felogin_forgotHash, auth_token, image', - 'export' => [ - 'include_files' => false, - ], - 'facets' => [ - 'uid', - 'username', - 'name', - 'first_name', - 'last_name', - 'address', - 'telephone', - 'fax', - 'email', - 'title', - 'zip', - 'city', - 'country', - 'company', - 'usergroup', - StandardFacet::class => [ - 'name' => 'disable', - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', - 'suggestions' => [ - '0' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.0', - '1' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active.1' - ] - ], - PageFacet::class => [ - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:facet.pid' - ], - ], - 'columns' => [ - '__checkbox' => [ - 'renderer' => CheckBoxRenderer::class, - ], - 'uid' => [ - 'visible' => false, - 'label' => 'Id', - 'width' => '5px', - ], - 'username' => [ - 'visible' => true, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:username', - 'editable' => true, - ], - 'name' => [ - 'visible' => true, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:name', - 'editable' => true, - ], - 'email' => [ - 'visible' => true, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:email', - 'editable' => true, - ], - 'usergroup' => [ - 'visible' => true, - 'renderers' => [ - 'Fab\Vidi\Grid\RelationEditRenderer', - 'Fab\Vidi\Grid\RelationRenderer', - ], - 'editable' => true, - 'sortable' => false, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf:usergroup', - ], - 'tstamp' => [ - 'visible' => false, - 'format' => 'Fab\Vidi\Formatter\Date', - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', - ], - 'crdate' => [ - 'visible' => false, - 'format' => 'Fab\Vidi\Formatter\Date', - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', - ], - #'disable' => [ - # 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', - # 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', - # 'width' => '3%', - #], - '__buttons' => [ - 'renderer' => ButtonGroupRenderer::class, - ], - ], - ], -]; - -ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['fe_users'], $tca); diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php deleted file mode 100644 index ba2e67a..0000000 --- a/Configuration/TCA/Overrides/tt_content.php +++ /dev/null @@ -1,58 +0,0 @@ - [ - 'excluded_fields' => 'image, imagewidth, imageorient, imagecols, imageborder, image_noRows, image_effects, image_compression, tx_impexp_origuid, image_zoom, - spaceAfter, spaceBefore, - uploads_description, uploads_type, - media, assets, table_caption, table_delimiter, table_enclosure, table_header_position, table_tfoot, table_bgColor, table_border, table_cellpadding, table_cellspacing, - icon, icon_position, icon_size, icon_type, icon_color, icon_background, uploads_description, uploads_type, - header_link, header_layout, header_position, - bullets_type, section_frame, - target, linkToTop, menu_type, list_type, select_key, - file_collections, filelink_size, filelink_sorting, - external_media_ratio, external_media_source', - 'columns' => [ - '__checkbox' => [ - 'renderer' => CheckBoxRenderer::class, - ], - 'uid' => [ - 'visible' => false, - 'label' => 'Id', - 'width' => '5px', - ], - 'header' => [ - 'editable' => true, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tt_content.xlf:header', - ], - 'tstamp' => [ - 'visible' => false, - 'format' => 'Fab\Vidi\Formatter\Date', - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:tstamp', - ], - 'crdate' => [ - 'visible' => false, - 'format' => 'Fab\Vidi\Formatter\Date', - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:crdate', - ], - 'hidden' => [ - 'renderer' => 'Fab\Vidi\Grid\VisibilityRenderer', - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:active', - 'width' => '3%', - ], - '__buttons' => [ - 'renderer' => ButtonGroupRenderer::class, - ], - ], - ], -]; - -ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['tt_content'], $tca); diff --git a/Configuration/TCA/tx_vidi_selection.php b/Configuration/TCA/tx_vidi_selection.php deleted file mode 100644 index b6f8c2f..0000000 --- a/Configuration/TCA/tx_vidi_selection.php +++ /dev/null @@ -1,92 +0,0 @@ - [ - 'title' => 'LLL:EXT:phpdisplay/Resources/Private/Language/locallang_db.xml:tx_phpdisplay_displays', - 'label' => 'name', - 'tstamp' => 'tstamp', - 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', - 'hideTable' => true, - 'delete' => 'deleted', - 'enablecolumns' => [ - 'disabled' => 'hidden', - ], - 'searchFields' => 'type,name,data_type', - 'typeicon_classes' => [ - 'default' => 'extensions-vidi-selection', - ], - ], - 'types' => [ - '1' => ['showitem' => 'hidden,--palette--;;1,type,name,data_type,query'], - ], - 'palettes' => [ - '1' => ['showitem' => ''], - ], - 'columns' => [ - - 'hidden' => [ - 'exclude' => 1, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hidden', - 'config' => [ - 'type' => 'check', - ], - ], - 'visibility' => [ - 'exclude' => 0, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility', - 'config' => [ - 'type' => 'select', - 'renderType' => 'selectSingle', - 'items' => [ - ['LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.everyone', 0], - ['LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.private', 1], - ['LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.admin_only', 2], - ], - 'size' => 1, - 'maxitems' => 1, - 'minitems' => 1, - ], - ], - 'name' => [ - 'exclude' => 0, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:name', - 'config' => [ - 'type' => 'input', - 'size' => 30, - 'eval' => 'trim,required' - ], - ], - 'data_type' => [ - 'exclude' => 0, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:data_type', - 'config' => [ - 'type' => 'input', - 'size' => 30, - 'eval' => 'trim,required' - ], - ], - 'query' => [ - 'exclude' => 0, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:query', - 'config' => [ - 'type' => 'text', - 'rows' => 5, - 'cols' => 5, - ], - ], - 'speaking_query' => [ - 'exclude' => 0, - 'label' => 'LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:speaking_query', - 'config' => [ - 'type' => 'text', - 'rows' => 5, - 'cols' => 5, - ], - ], - ], -]; diff --git a/ext_localconf.php b/ext_localconf.php index 0c6d22a..efa7782 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -8,32 +8,32 @@ defined('TYPO3') or die(); call_user_func(function () { - $configuration = GeneralUtility::makeInstance( - ExtensionConfiguration::class - )->get('vidi'); - - if (false === isset($configuration['autoload_typoscript']) || true === (bool)$configuration['autoload_typoscript']) { - ExtensionManagementUtility::addTypoScript( - 'vidi', - 'constants', - '' - ); - - ExtensionManagementUtility::addTypoScript( - 'vidi', - 'setup', - '' - ); - } - - // Initialize generic Vidi modules after the TCA is loaded. - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'][] = 'Fab\Vidi\Configuration\VidiModulesAspect'; - - // Initialize generic grid TCA for all data types - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'][] = 'Fab\Vidi\Configuration\TcaGridAspect'; - - // cache configuration, see https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/CachingFramework/Configuration/Index.html#cache-configurations - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vidi']['frontend'] = VariableFrontend::class; - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vidi']['groups'] = array('all', 'vidi'); - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vidi']['options']['defaultLifetime'] = 2592000; -}); +// $configuration = GeneralUtility::makeInstance( +// ExtensionConfiguration::class +// )->get('vidi'); +// +// if (false === isset($configuration['autoload_typoscript']) || true === (bool)$configuration['autoload_typoscript']) { +// ExtensionManagementUtility::addTypoScript( +// 'vidi', +// 'constants', +// '' +// ); +// +// ExtensionManagementUtility::addTypoScript( +// 'vidi', +// 'setup', +// '' +// ); +// } +// +// // Initialize generic Vidi modules after the TCA is loaded. +// $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'][] = 'Fab\Vidi\Configuration\VidiModulesAspect'; +// +// // Initialize generic grid TCA for all data types +// $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['extTablesInclusion-PostProcessing'][] = 'Fab\Vidi\Configuration\TcaGridAspect'; +// +// // cache configuration, see https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/CachingFramework/Configuration/Index.html#cache-configurations +// $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vidi']['frontend'] = VariableFrontend::class; +// $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vidi']['groups'] = array('all', 'vidi'); +// $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['vidi']['options']['defaultLifetime'] = 2592000; +}); \ No newline at end of file diff --git a/ext_tables.php b/ext_tables.php index d57d35a..b359271 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -4,7 +4,6 @@ use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use Fab\Vidi\Module\ModuleLoader; use Fab\Vidi\Backend\LanguageFileGenerator; -use TYPO3\CMS\Extbase\SignalSlot\Dispatcher; use Fab\Vidi\Processor\ContentObjectProcessor; use Fab\Vidi\Processor\MarkerProcessor; use Fab\Vidi\Tool\ToolRegistry; @@ -18,166 +17,165 @@ defined('TYPO3') or die(); call_user_func(function () { - // Check from Vidi configuration what default module should be loaded. - // Make sure the class exists to avoid a Runtime Error - - // Add content main module before 'user' - if (!isset($GLOBALS['TBE_MODULES']['content'])) { - // Position module "content" after module "user" manually. No API is available for that, it seems... - $modules = []; - foreach ($GLOBALS['TBE_MODULES'] as $key => $val) { - if ($key === 'user') { - $modules['content'] = ''; - } - $modules[$key] = $val; - } - $GLOBALS['TBE_MODULES'] = $modules; - - // Register "data management" module. - ExtensionManagementUtility::addModule( - 'content', - '', - '', - '', - [ - 'name' => 'content', - 'access' => 'user,group', - 'labels' => [ - 'll_ref' => 'LLL:EXT:vidi/Resources/Private/Language/content_module.xlf', - ], - ] - ); - } - - $configuration = GeneralUtility::makeInstance( - ExtensionConfiguration::class - )->get('vidi'); - - $pids = GeneralUtility::trimExplode(',', $configuration['default_pid'], true); - $defaultPid = array_shift($pids); - $defaultPids = []; - foreach ($pids as $dataTypeAndPid) { - $parts = GeneralUtility::trimExplode(':', $dataTypeAndPid); - if (count($parts) === 2) { - $defaultPids[$parts[0]] = $parts[1]; - } - } - - // Loop around the data types and register them to be displayed within a BE module. - if ($configuration['data_types']) { - $dataTypes = GeneralUtility::trimExplode(',', $configuration['data_types'], true); - foreach ($dataTypes as $dataType) { - /** @var ModuleLoader $moduleLoader */ - $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class, $dataType); - - // Special case already defined in Vidi. - if ($dataType === 'fe_users') { - $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf'; - $icon = 'EXT:vidi/Resources/Public/Images/fe_users.svg'; - } elseif ($dataType === 'fe_groups') { - $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf'; - $icon = 'EXT:vidi/Resources/Public/Images/fe_groups.svg'; - } else { - /** @var LanguageFileGenerator $languageService */ - $languageService = GeneralUtility::makeInstance(LanguageFileGenerator::class); - $languageFile = $languageService->generate($dataType); - $icon = ''; - } - - $pid = $defaultPids[$dataType] ?? $defaultPid; - - /** @var ModuleLoader $moduleLoader */ - $moduleLoader->setIcon($icon) - ->setModuleLanguageFile($languageFile) - ->setDefaultPid($pid) - ->register(); - } - } - - // Possible Static TS loading - if (true === isset($configuration['autoload_typoscript']) && false === (bool)$configuration['autoload_typoscript']) { - ExtensionManagementUtility::addStaticFile('vidi', 'Configuration/TypoScript', 'Vidi: versatile and interactive display'); - } - - // Register List2 only if beta feature is enabled. - // @todo let see what we do with that - #if ($configuration['activate_beta_features']) { - # $labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module.xlf'; - # - # if (!$configuration['hide_module_list']) { - # $labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module_transitional.xlf'; - # } - # - # \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( - # 'vidi', - # 'web', // Make module a submodule of 'web' - # 'm1', // Submodule key - # 'after:list', // Position - # array( - # 'Content' => 'index, list, delete, update, edit, copy, move, localize, sort, copyClipboard, moveClipboard', - # 'Tool' => 'welcome, work', - # 'Facet' => 'autoSuggest, autoSuggests', - # 'Selection' => 'edit, update, create, delete, list, show', - # 'UserPreferences' => 'save', - # 'Clipboard' => 'save, flush, show', - # ), array( - # 'access' => 'user,group', - # 'icon' => 'EXT:vidi/Resources/Public/Images/list.png', - # 'labels' => $labelFile, - # ) - # ); - #} - #if ($configuration['hide_module_list']) { - # - # // Default User TSConfig to be added in any case. - # TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' - # - # # Hide the module in the BE. - # options.hideModules.web := addToList(list) - # '); - #} - - /** @var $signalSlotDispatcher \TYPO3\CMS\Extbase\SignalSlot\Dispatcher */ - $signalSlotDispatcher = GeneralUtility::makeInstance(Dispatcher::class); - - // Connect "processContentData" signal slot with the "ContentObjectProcessor". - $signalSlotDispatcher->connect( - 'Fab\Vidi\Controller\Backend\ContentController', - 'processContentData', - ContentObjectProcessor::class, - 'processRelations', - true - ); - - // Connect "processContentData" signal with the "MarkerProcessor". - $signalSlotDispatcher->connect( - 'Fab\Vidi\Controller\Backend\ContentController', - 'processContentData', - MarkerProcessor::class, - 'processMarkers', - true - ); - - // Register default Tools for Vidi. - ToolRegistry::getInstance()->register('*', ModulePreferencesTool::class); - ToolRegistry::getInstance()->register('*', RelationAnalyserTool::class); - ToolRegistry::getInstance()->register('*', ConfiguredPidTool::class); - - // Add new sprite icon. - $icons = [ - 'go' => 'EXT:vidi/Resources/Public/Images/bullet_go.png', - 'query' => 'EXT:vidi/Resources/Public/Images/drive_disk.png', - ]; - /** @var IconRegistry $iconRegistry */ - $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); - foreach ($icons as $key => $icon) { - $iconRegistry->registerIcon( - 'extensions-vidi-' . $key, - BitmapIconProvider::class, - [ - 'source' => $icon - ] - ); - } - unset($iconRegistry); -}); +// // Check from Vidi configuration what default module should be loaded. +// // Make sure the class exists to avoid a Runtime Error +// +// // Add content main module before 'user' +// if (!isset($GLOBALS['TBE_MODULES']['content'])) { +// // Position module "content" after module "user" manually. No API is available for that, it seems... +// $modules = []; +// foreach ($GLOBALS['TBE_MODULES'] as $key => $val) { +// if ($key === 'user') { +// $modules['content'] = ''; +// } +// $modules[$key] = $val; +// } +// $GLOBALS['TBE_MODULES'] = $modules; +// +// // Register "data management" module. +// ExtensionManagementUtility::addModule( +// 'content', +// '', +// '', +// '', +// [ +// 'name' => 'content', +// 'access' => 'user,group', +// 'labels' => [ +// 'll_ref' => 'LLL:EXT:vidi/Resources/Private/Language/content_module.xlf', +// ], +// ] +// ); +// } +// +// $configuration = GeneralUtility::makeInstance( +// ExtensionConfiguration::class +// )->get('vidi'); +// +// $pids = GeneralUtility::trimExplode(',', $configuration['default_pid'], true); +// $defaultPid = array_shift($pids); +// $defaultPids = []; +// foreach ($pids as $dataTypeAndPid) { +// $parts = GeneralUtility::trimExplode(':', $dataTypeAndPid); +// if (count($parts) === 2) { +// $defaultPids[$parts[0]] = $parts[1]; +// } +// } +// +// // Loop around the data types and register them to be displayed within a BE module. +// if ($configuration['data_types']) { +// $dataTypes = GeneralUtility::trimExplode(',', $configuration['data_types'], true); +// foreach ($dataTypes as $dataType) { +// /** @var ModuleLoader $moduleLoader */ +// $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class, $dataType); +// +// // Special case already defined in Vidi. +// if ($dataType === 'fe_users') { +// $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf'; +// $icon = 'EXT:vidi/Resources/Public/Images/fe_users.svg'; +// } elseif ($dataType === 'fe_groups') { +// $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf'; +// $icon = 'EXT:vidi/Resources/Public/Images/fe_groups.svg'; +// } else { +// /** @var LanguageFileGenerator $languageService */ +// $languageService = GeneralUtility::makeInstance(LanguageFileGenerator::class); +// $languageFile = $languageService->generate($dataType); +// $icon = ''; +// } +// +// $pid = $defaultPids[$dataType] ?? $defaultPid; +// +// /** @var ModuleLoader $moduleLoader */ +// $moduleLoader->setIcon($icon) +// ->setModuleLanguageFile($languageFile) +// ->setDefaultPid($pid) +// ->register(); +// } +// } +// +// // Possible Static TS loading +// if (true === isset($configuration['autoload_typoscript']) && false === (bool)$configuration['autoload_typoscript']) { +// ExtensionManagementUtility::addStaticFile('vidi', 'Configuration/TypoScript', 'Vidi: versatile and interactive display'); +// } +// +// // Register List2 only if beta feature is enabled. +// // @todo let see what we do with that +// #if ($configuration['activate_beta_features']) { +// # $labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module.xlf'; +// # +// # if (!$configuration['hide_module_list']) { +// # $labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module_transitional.xlf'; +// # } +// # +// # \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( +// # 'vidi', +// # 'web', // Make module a submodule of 'web' +// # 'm1', // Submodule key +// # 'after:list', // Position +// # array( +// # 'Content' => 'index, list, delete, update, edit, copy, move, localize, sort, copyClipboard, moveClipboard', +// # 'Tool' => 'welcome, work', +// # 'Facet' => 'autoSuggest, autoSuggests', +// # 'Selection' => 'edit, update, create, delete, list, show', +// # 'UserPreferences' => 'save', +// # 'Clipboard' => 'save, flush, show', +// # ), array( +// # 'access' => 'user,group', +// # 'icon' => 'EXT:vidi/Resources/Public/Images/list.png', +// # 'labels' => $labelFile, +// # ) +// # ); +// #} +// #if ($configuration['hide_module_list']) { +// # +// # // Default User TSConfig to be added in any case. +// # TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' +// # +// # # Hide the module in the BE. +// # options.hideModules.web := addToList(list) +// # '); +// #} +// +// $signalSlotDispatcher = GeneralUtility::makeInstance(Dispatcher::class); +// +// // Connect "processContentData" signal slot with the "ContentObjectProcessor". +// $signalSlotDispatcher->connect( +// 'Fab\Vidi\Controller\Backend\ContentController', +// 'processContentData', +// ContentObjectProcessor::class, +// 'processRelations', +// true +// ); +// +// // Connect "processContentData" signal with the "MarkerProcessor". +// $signalSlotDispatcher->connect( +// 'Fab\Vidi\Controller\Backend\ContentController', +// 'processContentData', +// MarkerProcessor::class, +// 'processMarkers', +// true +// ); +// +// // Register default Tools for Vidi. +// ToolRegistry::getInstance()->register('*', ModulePreferencesTool::class); +// ToolRegistry::getInstance()->register('*', RelationAnalyserTool::class); +// ToolRegistry::getInstance()->register('*', ConfiguredPidTool::class); +// +// // Add new sprite icon. +// $icons = [ +// 'go' => 'EXT:vidi/Resources/Public/Images/bullet_go.png', +// 'query' => 'EXT:vidi/Resources/Public/Images/drive_disk.png', +// ]; +// /** @var IconRegistry $iconRegistry */ +// $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); +// foreach ($icons as $key => $icon) { +// $iconRegistry->registerIcon( +// 'extensions-vidi-' . $key, +// BitmapIconProvider::class, +// [ +// 'source' => $icon +// ] +// ); +// } +// unset($iconRegistry); +}); \ No newline at end of file diff --git a/ext_typoscript_setup.txt b/ext_typoscript_setup.txt deleted file mode 100644 index 3fd04e7..0000000 --- a/ext_typoscript_setup.txt +++ /dev/null @@ -1,15 +0,0 @@ -# This can be removed after TYPO3 v9 support is dropped -config.tx_extbase { - persistence{ - classes { - Fab\Vidi\Domain\Model\Selection { - mapping { - tableName = tx_vidi_selection - columns { - cruser_id.mapOnProperty = owner - } - } - } - } - } -} diff --git a/mod/content/conf.php b/mod/content/conf.php deleted file mode 100644 index 6110021..0000000 --- a/mod/content/conf.php +++ /dev/null @@ -1,5 +0,0 @@ - Date: Mon, 13 Oct 2025 15:35:41 +0000 Subject: [PATCH 02/11] [BUGFIX] fix errors corrections --- .../Domain/Repository/ContentRepository.php | 24 +++-- Classes/Tca/TableService.php | 92 +++++++++++++++++++ .../Content/AbstractContentViewHelper.php | 53 ++++++----- 3 files changed, 138 insertions(+), 31 deletions(-) diff --git a/Classes/Domain/Repository/ContentRepository.php b/Classes/Domain/Repository/ContentRepository.php index fc6f0fd..7cc0de9 100644 --- a/Classes/Domain/Repository/ContentRepository.php +++ b/Classes/Domain/Repository/ContentRepository.php @@ -119,8 +119,7 @@ public function findDistinctValues($propertyName, Matcher $matcher = null, Order // Assemble the final constraints or not. if ($matcherConstraint) { - $query->logicalAnd([$matcherConstraint, $constraint]); - $query->matching($query->logicalAnd([$matcherConstraint, $constraint])); + $query->matching($query->logicalAnd($matcherConstraint, $constraint)); } else { $query->matching($constraint); } @@ -155,8 +154,7 @@ public function countDistinctValues($propertyName, Matcher $matcher = null): int // Assemble the final constraints or not. if ($matcherConstraint) { - $query->logicalAnd([$matcherConstraint, $constraint]); - $query->matching($query->logicalAnd([$matcherConstraint, $constraint])); + $query->matching($query->logicalAnd($matcherConstraint, $constraint)); } else { $query->matching($constraint); } @@ -603,7 +601,7 @@ protected function computeConstraints(Query $query, Matcher $matcher): ?Constrai if (count($collectedConstraints) > 1) { $logical = $matcher->getDefaultLogicalSeparator(); - $constraints = $query->$logical($collectedConstraints); + $constraints = $query->$logical(...$collectedConstraints); } elseif (!empty($collectedConstraints)) { // true means there is one constraint only and should become the result $constraints = current($collectedConstraints); @@ -645,7 +643,12 @@ protected function computeSearchTermConstraint(Query $query, Matcher $matcher): } } $logical = $matcher->getLogicalSeparatorForSearchTerm(); - $result = $query->$logical($constraints); + // Fix for TYPO3 v12 compatibility: only use logical operator if there are multiple constraints + if (count($constraints) > 1) { + $result = $query->$logical(...$constraints); + } elseif (count($constraints) === 1) { + $result = $constraints[0]; + } } return $result; @@ -736,7 +739,12 @@ protected function computeConstraint(Query $query, Matcher $matcher, $operator): ? $matcher->$getLogicalSeparator() : $matcher->getDefaultLogicalSeparator(); - $result = $query->$logical($constraints); + // Fix for TYPO3 v12 compatibility: only use logical operator if there are multiple constraints + if (count($constraints) > 1) { + $result = $query->$logical(...$constraints); + } elseif (count($constraints) === 1) { + $result = $constraints[0]; + } } return $result; @@ -860,4 +868,4 @@ protected function getLanguageValidator(): LanguageValidator // { // return GeneralUtility::makeInstance(Dispatcher::class); // } -} \ No newline at end of file +} diff --git a/Classes/Tca/TableService.php b/Classes/Tca/TableService.php index f149644..b6be543 100644 --- a/Classes/Tca/TableService.php +++ b/Classes/Tca/TableService.php @@ -410,6 +410,95 @@ public function hasAccess() return $hasAccess; } + /** + * Check if a field is a virtual/calculated field that exists in database but not in TCA. + * + * @param string $fieldName + * @return bool + */ + protected function isVirtualField($fieldName) + { + $virtualFields = $this->getVirtualFieldsForTable($this->tableName); + return in_array($fieldName, $virtualFields, true); + } + + /** + * Get virtual field configuration for fields that exist in database but don't have TCA entries. + * + * @param string $fieldName + * @return array + */ + protected function getVirtualFieldConfiguration($fieldName) + { + $configuration = [ + 'config' => [ + 'type' => 'input', + 'readOnly' => true, + ] + ]; + + // Special configuration for specific virtual fields + switch ($fieldName) { + case 'number_of_references': + $configuration['config']['type'] = 'input'; + $configuration['config']['eval'] = 'int'; + $configuration['label'] = 'Number of References'; + break; + case 'usage_count': + $configuration['config']['type'] = 'input'; + $configuration['config']['eval'] = 'int'; + $configuration['label'] = 'Usage Count'; + break; + case 'reference_count': + $configuration['config']['type'] = 'input'; + $configuration['config']['eval'] = 'int'; + $configuration['label'] = 'Reference Count'; + break; + case 'extension': + $configuration['config']['type'] = 'input'; + $configuration['config']['eval'] = 'trim'; + $configuration['config']['max'] = 10; + $configuration['label'] = 'File Extension'; + break; + } + + return $configuration; + } + + /** + * Get list of virtual fields for a specific table that exist in database but not in TCA. + * + * @param string $tableName + * @return array + */ + protected function getVirtualFieldsForTable($tableName) + { + $virtualFields = []; + + // Define virtual/calculated fields per table that exist in database + switch ($tableName) { + case 'sys_file': + $virtualFields = [ + 'number_of_references', + 'usage_count', + 'reference_count', + 'extension' + ]; + break; + case 'sys_file_metadata': + $virtualFields = [ + 'file_size_formatted', + 'dimensions_formatted' + ]; + break; + default: + // No virtual fields for other tables by default + break; + } + + return $virtualFields; + } + /** * @param string $fieldName * @throws \Exception @@ -435,6 +524,9 @@ public function field($fieldName) // True for system fields such as uid, pid that don't necessarily have a TCA. if (empty($this->columnTca[$fieldName]) && in_array($fieldName, Tca::getSystemFields())) { $this->columnTca[$fieldName] = []; + } elseif (empty($this->columnTca[$fieldName]) && $this->isVirtualField($fieldName)) { + // Handle virtual/calculated fields that don't have TCA entries but exist in database + $this->columnTca[$fieldName] = $this->getVirtualFieldConfiguration($fieldName); } elseif (empty($this->columnTca[$fieldName])) { $message = sprintf( 'Does the field really exist? No TCA entry found for field "%s" for table "%s"', diff --git a/Classes/ViewHelpers/Content/AbstractContentViewHelper.php b/Classes/ViewHelpers/Content/AbstractContentViewHelper.php index 2154a16..f3bf40c 100644 --- a/Classes/ViewHelpers/Content/AbstractContentViewHelper.php +++ b/Classes/ViewHelpers/Content/AbstractContentViewHelper.php @@ -20,6 +20,7 @@ use Fab\Vidi\Persistence\Matcher; use Fab\Vidi\Persistence\Order; use Fab\Vidi\Tca\Tca; +use Psr\EventDispatcher\EventDispatcherInterface; /** * Abstract View helper for handling Content display mainly on the Frontend. @@ -156,10 +157,11 @@ public function getResultSetStorage() * @param string $dataType * @param Order $order */ -// protected function emitPostProcessOrderObjectSignal($dataType, Order $order) -// { -// $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessOrderObject', array($order, $dataType)); -// } + protected function emitPostProcessOrderObjectSignal($dataType, Order $order) + { + // For TYPO3 v12 compatibility - signals are deprecated, using empty method to prevent errors + // If you need event dispatching, implement PSR-14 events instead + } /** * Signal that is called for post-processing a "matcher" object. @@ -167,10 +169,11 @@ public function getResultSetStorage() * @param string $dataType * @param Matcher $matcher */ -// protected function emitPostProcessMatcherObjectSignal($dataType, Matcher $matcher) -// { -// $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessMatcherObject', array($matcher, $dataType)); -// } + protected function emitPostProcessMatcherObjectSignal($dataType, Matcher $matcher) + { + // For TYPO3 v12 compatibility - signals are deprecated, using empty method to prevent errors + // If you need event dispatching, implement PSR-14 events instead + } /** * Signal that is called for post-processing a "limit". @@ -178,10 +181,11 @@ public function getResultSetStorage() * @param string $dataType * @param int $limit */ -// protected function emitPostProcessLimitSignal($dataType, $limit) -// { -// $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessLimit', array($limit, $dataType)); -// } + protected function emitPostProcessLimitSignal($dataType, $limit) + { + // For TYPO3 v12 compatibility - signals are deprecated, using empty method to prevent errors + // If you need event dispatching, implement PSR-14 events instead + } /** * Signal that is called for post-processing a "offset". @@ -189,20 +193,23 @@ public function getResultSetStorage() * @param string $dataType * @param int $offset */ -// protected function emitPostProcessOffsetSignal($dataType, $offset) -// { -// $this->getSignalSlotDispatcher()->dispatch('Fab\Vidi\ViewHelper\Content\AbstractContentViewHelper', 'postProcessLimit', array($offset, $dataType)); -// } + protected function emitPostProcessOffsetSignal($dataType, $offset) + { + // For TYPO3 v12 compatibility - signals are deprecated, using empty method to prevent errors + // If you need event dispatching, implement PSR-14 events instead + } /** - * Get the SignalSlot dispatcher + * Get the SignalSlot dispatcher (deprecated in TYPO3 v12) * - * @return Dispatcher + * @return EventDispatcherInterface|null */ -// protected function getSignalSlotDispatcher() -// { -// return GeneralUtility::makeInstance(Dispatcher::class); -// } + protected function getSignalSlotDispatcher() + { + // For TYPO3 v12 compatibility - SignalSlot is deprecated + // Return null to prevent errors, implement PSR-14 events if needed + return null; + } /** * @param $ignoreEnableFields @@ -223,4 +230,4 @@ protected function getFieldPathResolver() { return GeneralUtility::makeInstance(FieldPathResolver::class); } -} \ No newline at end of file +} From 9b23e9a91a8e8ee0d3edf2987918caeaa99a4ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hyacinthe=20Compaor=C3=A9?= <131278191+compaoreh338@users.noreply.github.com> Date: Wed, 15 Oct 2025 09:36:50 +0000 Subject: [PATCH 03/11] [BUGFIX] fix errors From 6eb936af141b7f716d3f1fd08b84da21166af39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hyacinthe=20Compaor=C3=A9?= <131278191+compaoreh338@users.noreply.github.com> Date: Thu, 16 Oct 2025 09:32:53 +0000 Subject: [PATCH 04/11] fixup! [BUGFIX] fix errors --- Classes/Tca/FieldService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Classes/Tca/FieldService.php b/Classes/Tca/FieldService.php index 2b0feec..2627bf4 100644 --- a/Classes/Tca/FieldService.php +++ b/Classes/Tca/FieldService.php @@ -382,8 +382,11 @@ public function getLabelForItem($itemValue) if (!empty($configuration['items']) && is_array($configuration['items'])) { foreach ($configuration['items'] as $item) { if ($item[1] == $itemValue) { + $label = null; try { - $label = LocalizationUtility::translate($item[0], ''); + if ($item[0] !== null && is_string($item[0])) { + $label = LocalizationUtility::translate($item[0], 'vidi'); + } } catch (\InvalidArgumentException $e) { } if (empty($label)) { From f7bdf709f6d8508e13e863ac6b3e4dd84874d6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hyacinthe=20Compaor=C3=A9?= <131278191+compaoreh338@users.noreply.github.com> Date: Tue, 18 Nov 2025 11:57:43 +0000 Subject: [PATCH 05/11] Update typo3/cms-core version requirement --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 96741d9..361cda9 100644 --- a/composer.json +++ b/composer.json @@ -28,6 +28,6 @@ }, "require": { "php": ">=8.0", - "typo3/cms-core": "^11 || ^12" + "typo3/cms-core": "^11 || ^12 || ^13" } } From 3f17da5993e58072cdf62b307af14bbcd19e16b7 Mon Sep 17 00:00:00 2001 From: Fabien Udriot Date: Wed, 3 Dec 2025 09:25:47 +0100 Subject: [PATCH 06/11] Release 7.0.0 - --- CHANGELOG.md | 16 ++++++++++++++++ composer.json | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 592b55a..a6bc74e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +## 7.0.0 (2025-12-03) + +Update typo3/cms-core version requirement +fixup! [BUGFIX] fix errors +[BUGFIX] fix errors +[BUGFIX] fix errors corrections +[TASK] Remove v11 legacy code +Update composer.json +[BUGFIX] Remove dependency to laravel/pint +[BUGFIX] Stop export download to open a new backend window +[BUGFIX] Fix export file download using a response object +[BUGFIX] Fix value type for content length header +[FEATURE] Introduce class property for facets +[TASK] Remove unwanted dropdown menu markup +[BUGFIX] Fix user TSConfig retrieval + ## 6.0.0 (2022-11-17) [BUGFIX] Correct interface signature for php >= 8.0 diff --git a/composer.json b/composer.json index 361cda9..ffefa0b 100644 --- a/composer.json +++ b/composer.json @@ -28,6 +28,6 @@ }, "require": { "php": ">=8.0", - "typo3/cms-core": "^11 || ^12 || ^13" + "typo3/cms-core": "^12" } } From b0dcdf99a422f78a9d5f954cf4f586fe9f9412fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hyacinthe=20Compaor=C3=A9?= <131278191+compaoreh338@users.noreply.github.com> Date: Wed, 3 Dec 2025 09:26:07 +0000 Subject: [PATCH 07/11] TYPO3 v13 compatibility --- Classes/Backend/LanguageFileGenerator.php | 5 ++- .../Configuration/ConfigurationUtility.php | 2 +- Classes/Configuration/TcaGridAspect.php | 5 +-- Classes/Configuration/VidiModulesAspect.php | 5 +-- Classes/Controller/ClipboardController.php | 2 +- Classes/Controller/ContentController.php | 38 +++++++++---------- Classes/Controller/FacetController.php | 6 +-- Classes/Controller/SelectionController.php | 4 +- Classes/Controller/ToolController.php | 2 +- Classes/DataHandler/CoreDataHandler.php | 2 +- .../Domain/Repository/ContentRepository.php | 4 +- Classes/Domain/Validator/ContentValidator.php | 2 +- .../Domain/Validator/LanguageValidator.php | 2 +- Classes/Facet/PageFacet.php | 17 +++------ Classes/Module/ModuleLoader.php | 10 ++--- Classes/Module/ModulePidService.php | 16 +++----- Classes/Module/ModulePreferences.php | 4 +- Classes/Mvc/JsonResult.php | 2 +- Classes/Persistence/MatcherObjectFactory.php | 6 +-- Classes/Persistence/Order.php | 2 +- Classes/Persistence/OrderObjectFactory.php | 2 +- Classes/Persistence/Pager.php | 8 ++-- Classes/Persistence/PagerObjectFactory.php | 8 ++-- Classes/Persistence/Query.php | 4 +- Classes/Persistence/ResultSetStorage.php | 2 +- Classes/Persistence/Storage/VidiDbBackend.php | 20 +++------- .../Service/BackendUserPreferenceService.php | 2 +- Classes/Service/ClipboardService.php | 4 +- Classes/Service/DataService.php | 7 +++- Classes/Service/SpreadSheetService.php | 2 +- Classes/Tca/FieldService.php | 2 +- Classes/Utility/BackendUtility.php | 19 +++------- Classes/View/Button/NewButton.php | 8 ++-- Classes/View/Grid/Row.php | 2 +- .../Be/AdditionalAssetsViewHelper.php | 2 +- .../ViewHelpers/Be/RequireJsViewHelper.php | 2 +- .../ViewHelpers/Button/ToolWorkViewHelper.php | 2 +- .../Content/AbstractContentViewHelper.php | 2 +- .../ViewHelpers/Content/FindOneViewHelper.php | 6 +-- .../ViewHelpers/Content/FindViewHelper.php | 2 +- Classes/ViewHelpers/GpViewHelper.php | 6 +-- .../Grid/Column/CanBeHiddenViewHelper.php | 2 +- .../Grid/Column/HeaderViewHelper.php | 2 +- .../Grid/Column/IsEditableViewHelper.php | 2 +- .../Grid/Column/IsExcludedViewHelper.php | 2 +- .../Grid/Column/IsVisibleViewHelper.php | 2 +- .../Grid/PreferencesViewHelper.php | 2 +- Classes/ViewHelpers/IsRelatedToViewHelper.php | 2 +- Classes/ViewHelpers/Link/BackViewHelper.php | 4 +- .../ViewHelpers/ModuleLoaderViewHelper.php | 2 +- .../ModulePreferencesViewHelper.php | 2 +- .../Render/ComponentsViewHelper.php | 2 +- .../ViewHelpers/Result/ToCsvViewHelper.php | 2 +- .../ViewHelpers/Result/ToJsonViewHelper.php | 6 +-- .../ViewHelpers/Result/ToXlsViewHelper.php | 2 +- .../ViewHelpers/Result/ToXmlViewHelper.php | 2 +- Classes/ViewHelpers/SpriteViewHelper.php | 2 +- Classes/ViewHelpers/Tca/LabelViewHelper.php | 2 +- Classes/ViewHelpers/Tca/TableViewHelper.php | 2 +- Classes/ViewHelpers/Tca/TitleViewHelper.php | 2 +- .../ViewHelpers/UserPreferencesViewHelper.php | 2 +- Tests/Feature/bootstrap/FeatureContext.php | 2 +- Tests/Functional/Domain/Model/ContentTest.php | 12 +++--- .../Functional/Grid/RelationRendererTest.php | 4 +- Tests/Functional/Module/ModuleLoaderTest.php | 10 ++--- Tests/Unit/Formatter/DateTest.php | 6 +-- Tests/Unit/Formatter/DatetimeTest.php | 6 +-- Tests/Unit/Module/ModulePreferencesTest.php | 2 +- Tests/Unit/Tca/AbstractServiceTest.php | 13 +++---- Tests/Unit/Tca/FieldServiceTest.php | 16 ++++---- Tests/Unit/Tca/GridServiceTest.php | 36 +++++++++--------- Tests/Unit/Tca/TableServiceTest.php | 8 ++-- 72 files changed, 192 insertions(+), 217 deletions(-) diff --git a/Classes/Backend/LanguageFileGenerator.php b/Classes/Backend/LanguageFileGenerator.php index cc2ac2a..654ec62 100644 --- a/Classes/Backend/LanguageFileGenerator.php +++ b/Classes/Backend/LanguageFileGenerator.php @@ -36,6 +36,9 @@ class LanguageFileGenerator implements SingletonInterface '; + public function __construct(private readonly \TYPO3\CMS\Core\Localization\LanguageServiceFactory $languageServiceFactory) + { + } /** * @param string $dataType @@ -87,7 +90,7 @@ protected function getLanguageService() if ($locale === '') { $locale = 'en'; } - $languageServiceFactory = GeneralUtility::makeInstance(LanguageServiceFactory::class); + $languageServiceFactory = $this->languageServiceFactory; return $languageServiceFactory->create($locale); } } diff --git a/Classes/Configuration/ConfigurationUtility.php b/Classes/Configuration/ConfigurationUtility.php index f81e912..5f7b192 100644 --- a/Classes/Configuration/ConfigurationUtility.php +++ b/Classes/Configuration/ConfigurationUtility.php @@ -70,7 +70,7 @@ public function get($key) * @param mixed $value * @return void */ - public function set($key, $value) + public function set($key, $value): void { $this->configuration[$key] = $value; } diff --git a/Classes/Configuration/TcaGridAspect.php b/Classes/Configuration/TcaGridAspect.php index 02f9e20..1331105 100644 --- a/Classes/Configuration/TcaGridAspect.php +++ b/Classes/Configuration/TcaGridAspect.php @@ -11,18 +11,17 @@ use Fab\Vidi\Grid\ButtonGroupRenderer; use Fab\Vidi\Grid\CheckBoxRenderer; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; -use TYPO3\CMS\Core\Database\TableConfigurationPostProcessingHookInterface; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; /** * Add a Grid TCA to each "data type" enabling to display a Vidi module in the BE. */ -class TcaGridAspect implements TableConfigurationPostProcessingHookInterface +class TcaGridAspect { /** * Scans each data type of the TCA and add a Grid TCA if missing. - * + * implements TableConfigurationPostProcessingHookInterface * @return array */ public function processData() diff --git a/Classes/Configuration/VidiModulesAspect.php b/Classes/Configuration/VidiModulesAspect.php index a649db4..923cc24 100644 --- a/Classes/Configuration/VidiModulesAspect.php +++ b/Classes/Configuration/VidiModulesAspect.php @@ -10,20 +10,19 @@ */ use Fab\Vidi\Module\ModuleLoader; use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; -use TYPO3\CMS\Core\Database\TableConfigurationPostProcessingHookInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; /** * Initialize Vidi modules */ -class VidiModulesAspect implements TableConfigurationPostProcessingHookInterface +class VidiModulesAspect { /** * Initialize and populate TBE_MODULES_EXT with default data. * * @return void */ - public function processData() + public function processData(): void { /** @var ModuleLoader $moduleLoader */ $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); diff --git a/Classes/Controller/ClipboardController.php b/Classes/Controller/ClipboardController.php index 3d4a29e..e307651 100644 --- a/Classes/Controller/ClipboardController.php +++ b/Classes/Controller/ClipboardController.php @@ -72,7 +72,7 @@ public function showAction(): ResponseInterface $contentService = $this->getContentService()->findBy($matcher); // count number of items and display it. - $this->view->assign('target', GeneralUtility::_GP('id')); + $this->view->assign('target', $this->request->getParsedBody()['id'] ?? $this->request->getQueryParams()['id'] ?? null); $this->view->assign('numberOfObjects', $contentService->getNumberOfObjects()); $this->view->assign('objects', $contentService->getObjects()); return $this->htmlResponse(); diff --git a/Classes/Controller/ContentController.php b/Classes/Controller/ContentController.php index c6921f5..2355b38 100644 --- a/Classes/Controller/ContentController.php +++ b/Classes/Controller/ContentController.php @@ -43,10 +43,13 @@ */ class ContentController extends ActionController { + public function __construct(private readonly \Fab\Vidi\Domain\Repository\SelectionRepository $selectionRepository) + { + } /** * Initialize every action. */ - public function initializeAction() + public function initializeAction():void { $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->addInlineLanguageLabelFile('EXT:vidi/Resources/Private/Language/locallang.xlf'); @@ -83,10 +86,10 @@ public function indexAction(): ResponseInterface * * @param array $columns corresponds to columns to be rendered. * @param array $matches - * @Validate("Fab\Vidi\Domain\Validator\ColumnsValidator", param="columns") - * @Validate("Fab\Vidi\Domain\Validator\MatchesValidator", param="matches") * @return void */ + #[Validate(['validator' => \Fab\Vidi\Domain\Validator\ColumnsValidator::class, 'param' => 'columns'])] + #[Validate(['validator' => \Fab\Vidi\Domain\Validator\MatchesValidator::class, 'param' => 'matches'])] public function listAction(array $columns = [], $matches = []): ResponseInterface { // Initialize some objects related to the query. @@ -133,7 +136,7 @@ public function listAction(array $columns = [], $matches = []): ResponseInterfac * @param array $columns * @throws InvalidKeyInArrayException */ - public function updateAction($fieldNameAndPath, array $content, array $matches = [], $savingBehavior = SavingBehavior::REPLACE, $language = 0, $columns = []) + public function updateAction($fieldNameAndPath, array $content, array $matches = [], $savingBehavior = SavingBehavior::REPLACE, $language = 0, $columns = []): \Psr\Http\Message\ResponseInterface { // Instantiate the Matcher object according different rules. $matcher = MatcherObjectFactory::getInstance()->getMatcher($matches); @@ -230,7 +233,7 @@ public function updateAction($fieldNameAndPath, array $content, array $matches = * @param array $matches * @param int $previousIdentifier */ - public function sortAction(array $matches = [], $previousIdentifier = null) + public function sortAction(array $matches = [], $previousIdentifier = null): \Psr\Http\Message\ResponseInterface { $matcher = MatcherObjectFactory::getInstance()->getMatcher($matches); @@ -385,7 +388,7 @@ public function editAction($fieldNameAndPath, array $matches = [], $hasRecursive * * @param array $matches */ - public function deleteAction(array $matches = []) + public function deleteAction(array $matches = []): \Psr\Http\Message\ResponseInterface { $matcher = MatcherObjectFactory::getInstance()->getMatcher($matches); @@ -446,7 +449,7 @@ public function copyAction($target, array $matches = []) * @param string $target * @throws \Exception */ - public function copyClipboardAction($target) + public function copyClipboardAction($target): \Psr\Http\Message\ResponseInterface { // Retrieve matcher object from clipboard. $matcher = $this->getClipboardService()->getMatcher(); @@ -481,7 +484,7 @@ public function copyClipboardAction($target) } // Flush Clipboard if told so. - if (GeneralUtility::_GP('flushClipboard')) { + if ($this->request->getParsedBody()['flushClipboard'] ?? $this->request->getQueryParams()['flushClipboard'] ?? null) { $this->getClipboardService()->flush(); } @@ -499,7 +502,7 @@ public function copyClipboardAction($target) * @param string $target * @param array $matches */ - public function moveAction($target, array $matches = []) + public function moveAction($target, array $matches = []): \Psr\Http\Message\ResponseInterface { $matcher = MatcherObjectFactory::getInstance()->getMatcher($matches); @@ -543,7 +546,7 @@ public function moveAction($target, array $matches = []) * * @param string $target */ - public function moveClipboardAction($target) + public function moveClipboardAction($target): \Psr\Http\Message\ResponseInterface { // Retrieve matcher object from clipboard. $matcher = $this->getClipboardService()->getMatcher(); @@ -578,7 +581,7 @@ public function moveClipboardAction($target) } // Flush Clipboard if told so. - if (GeneralUtility::_GP('flushClipboard')) { + if ($this->request->getParsedBody()['flushClipboard'] ?? $this->request->getQueryParams()['flushClipboard'] ?? null) { $this->getClipboardService()->flush(); } @@ -598,7 +601,7 @@ public function moveClipboardAction($target) * @param int $language * @throws \Exception */ - public function localizeAction($fieldNameAndPath, array $matches = [], $language = 0) + public function localizeAction($fieldNameAndPath, array $matches = [], $language = 0): \Psr\Http\Message\ResponseInterface { $matcher = MatcherObjectFactory::getInstance()->getMatcher($matches); @@ -654,7 +657,9 @@ public function localizeAction($fieldNameAndPath, array $matches = [], $language /** @var EditUri $uri */ $uriRenderer = GeneralUtility::makeInstance(EditUri::class); $uri = $uriRenderer->render($localizedContent); - HttpUtility::redirect($uri); + + $response = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Psr\Http\Message\ResponseFactoryInterface::class)->createResponse(\TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303)->withAddedHeader('location', $uri); + throw new \TYPO3\CMS\Core\Http\PropagateResponseException($response, 9221048242); break; // no need to further continue } @@ -764,9 +769,4 @@ protected function getModuleLoader() { return GeneralUtility::makeInstance(ModuleLoader::class); } - - public function injectSelectionRepository(SelectionRepository $selectionRepository): void - { - $this->selectionRepository = $selectionRepository; - } -} \ No newline at end of file +} diff --git a/Classes/Controller/FacetController.php b/Classes/Controller/FacetController.php index dfe6192..ad75b6f 100644 --- a/Classes/Controller/FacetController.php +++ b/Classes/Controller/FacetController.php @@ -27,9 +27,9 @@ class FacetController extends ActionController * * @param string $facet * @param string $searchTerm - * @Validate("Fab\Vidi\Domain\Validator\FacetValidator", param="facet") */ - public function autoSuggestAction($facet, $searchTerm) + #[Validate(['validator' => \Fab\Vidi\Domain\Validator\FacetValidator::class, 'param' => 'facet'])] + public function autoSuggestAction($facet, $searchTerm): \Psr\Http\Message\ResponseInterface { $suggestions = $this->getFacetSuggestionService()->getSuggestions($facet); @@ -43,7 +43,7 @@ public function autoSuggestAction($facet, $searchTerm) * Suggest values for all configured facets in the Grid. * Output a json list of key / values. */ - public function autoSuggestsAction() + public function autoSuggestsAction(): \Psr\Http\Message\ResponseInterface { $suggestions = []; foreach (Tca::grid()->getFacets() as $facet) { diff --git a/Classes/Controller/SelectionController.php b/Classes/Controller/SelectionController.php index 2fc5370..f8767db 100644 --- a/Classes/Controller/SelectionController.php +++ b/Classes/Controller/SelectionController.php @@ -32,7 +32,7 @@ public function createAction(Selection $selection = null) $selection->setOwner($this->getBackendUser()->user['uid']); $selectionRepository->add($selection); - $this->redirect('edit', 'Selection', 'vidi', array('dataType' => $selection->getDataType())); + return $this->redirect('edit', 'Selection', 'vidi', array('dataType' => $selection->getDataType())); } /** @@ -53,7 +53,7 @@ public function updateAction(Selection $selection) { $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); $selectionRepository->update($selection); - $this->redirect('show', 'Selection', 'vidi', array('selection' => $selection->getUid())); + return $this->redirect('show', 'Selection', 'vidi', array('selection' => $selection->getUid())); } /** diff --git a/Classes/Controller/ToolController.php b/Classes/Controller/ToolController.php index 684c948..a9e7bde 100644 --- a/Classes/Controller/ToolController.php +++ b/Classes/Controller/ToolController.php @@ -44,8 +44,8 @@ public function welcomeAction(): ResponseInterface * @param string $tool * @param array $arguments * @return void - * @Extbase\Validate("Fab\Vidi\Domain\Validator\ToolValidator", param="tool") */ + #[Extbase\Validate(['validator' => \Fab\Vidi\Domain\Validator\ToolValidator::class, 'param' => 'tool'])] public function workAction(string $tool, array $arguments = array()): ResponseInterface { /** @var ToolInterface $tool */ diff --git a/Classes/DataHandler/CoreDataHandler.php b/Classes/DataHandler/CoreDataHandler.php index 6fbb828..9b417ac 100644 --- a/Classes/DataHandler/CoreDataHandler.php +++ b/Classes/DataHandler/CoreDataHandler.php @@ -88,7 +88,7 @@ public function processRemove(Content $content) * @param string $target * @return bool */ - public function processCopy(Content $content, $target) + public function processCopy(Content $content, $target): void { // TODO: Implement processCopy() method. } diff --git a/Classes/Domain/Repository/ContentRepository.php b/Classes/Domain/Repository/ContentRepository.php index 7cc0de9..1a01c56 100644 --- a/Classes/Domain/Repository/ContentRepository.php +++ b/Classes/Domain/Repository/ContentRepository.php @@ -404,7 +404,7 @@ public function countAll() * @return void * @api */ - public function removeAll() + public function removeAll(): void { // TODO: Implement removeAll() method. } @@ -510,7 +510,7 @@ public function setDefaultOrderings(array $defaultOrderings) * @return void * @api */ - public function setDefaultQuerySettings(QuerySettingsInterface $defaultQuerySettings) + public function setDefaultQuerySettings(QuerySettingsInterface $defaultQuerySettings): void { $this->defaultQuerySettings = $defaultQuerySettings; } diff --git a/Classes/Domain/Validator/ContentValidator.php b/Classes/Domain/Validator/ContentValidator.php index 800a8da..ba1ad64 100644 --- a/Classes/Domain/Validator/ContentValidator.php +++ b/Classes/Domain/Validator/ContentValidator.php @@ -24,7 +24,7 @@ class ContentValidator * @throws \Exception * @return void */ - public function validate(Content $content) + public function validate(Content $content): void { // Security check. if ($content->getUid() <= 0) { diff --git a/Classes/Domain/Validator/LanguageValidator.php b/Classes/Domain/Validator/LanguageValidator.php index ba00886..d27faff 100644 --- a/Classes/Domain/Validator/LanguageValidator.php +++ b/Classes/Domain/Validator/LanguageValidator.php @@ -23,7 +23,7 @@ class LanguageValidator * @throws \Exception * @return void */ - public function validate($language) + public function validate($language): void { if (!$this->getLanguageService()->languageExists((int)$language)) { throw new \Exception('The language "' . $language . '" does not exist', 1351605542); diff --git a/Classes/Facet/PageFacet.php b/Classes/Facet/PageFacet.php index f81591c..fc8654f 100644 --- a/Classes/Facet/PageFacet.php +++ b/Classes/Facet/PageFacet.php @@ -93,18 +93,13 @@ protected function getStoragePages(): array $query = $this->getQueryBuilder('pages'); $query->getRestrictions()->removeAll(); return $query->select('*') - ->from('pages') - ->where( - sprintf( - 'uid IN (SELECT DISTINCT(pid) FROM %s WHERE 1=1 %s)', - $this->getModuleLoader()->getDataType(), - BackendUtility::deleteClause( - $this->getModuleLoader()->getDataType() - ) - ), - BackendUtility::deleteClause('pages', '') + ->from('pages')->where(sprintf( + 'uid IN (SELECT DISTINCT(pid) FROM %s WHERE 1=1 %s)', + $this->getModuleLoader()->getDataType(), + BackendUtility::deleteClause( + $this->getModuleLoader()->getDataType() ) - ->execute() + ), BackendUtility::deleteClause('pages', ''))->executeQuery() ->fetchAllAssociative(); } diff --git a/Classes/Module/ModuleLoader.php b/Classes/Module/ModuleLoader.php index 05cb857..f57be3c 100644 --- a/Classes/Module/ModuleLoader.php +++ b/Classes/Module/ModuleLoader.php @@ -335,7 +335,7 @@ public function register(): self */ public function getSignature(): string { - $signature = GeneralUtility::_GP(Parameter::MODULE); + $signature = $GLOBALS['TYPO3_REQUEST']->getParsedBody()[Parameter::MODULE] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::MODULE] ?? null; $trimmedSignature = trim($signature, '/'); return str_replace(['/', 'module_'], ['_', ''], $trimmedSignature); } @@ -347,7 +347,7 @@ public function getSignature(): string */ public function getCurrentPid(): int { - return GeneralUtility::_GET(Parameter::PID) > 0 ? (int)GeneralUtility::_GET(Parameter::PID) : 0; + return ($GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null) > 0 ? (int)($GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null) : 0; } /** @@ -361,8 +361,8 @@ public function getModuleUrl(array $additionalParameters = []): string $moduleCode = $this->getSignature(); // And don't forget the pid! - if (GeneralUtility::_GET(Parameter::PID)) { - $additionalParameters[Parameter::PID] = GeneralUtility::_GET(Parameter::PID); + if ($GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null) { + $additionalParameters[Parameter::PID] = $GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null; } return BackendUtility::getModuleUrl($moduleCode, $additionalParameters); @@ -1001,7 +1001,7 @@ public function getComponents(): array public function hasPlugin($pluginName = ''): bool { $parameterPrefix = $this->getParameterPrefix(); - $parameters = GeneralUtility::_GET($parameterPrefix); + $parameters = $GLOBALS['TYPO3_REQUEST']->getQueryParams()[$parameterPrefix] ?? null; $hasPlugin = !empty($parameters['plugins']) && is_array($parameters['plugins']); if ($hasPlugin && $pluginName) { diff --git a/Classes/Module/ModulePidService.php b/Classes/Module/ModulePidService.php index 4b479e9..b13ee8c 100644 --- a/Classes/Module/ModulePidService.php +++ b/Classes/Module/ModulePidService.php @@ -38,7 +38,7 @@ class ModulePidService /** * ModulePidService constructor. */ - public function __construct() + public function __construct(private readonly \TYPO3\CMS\Core\Database\ConnectionPool $connectionPool) { $this->dataType = $this->getModuleLoader()->getDataType(); } @@ -81,8 +81,8 @@ public function validateConfiguredPid(): array */ public function getConfiguredNewRecordPid(): int { - if (GeneralUtility::_GP(Parameter::PID)) { - $configuredPid = (int)GeneralUtility::_GP(Parameter::PID); + if ($GLOBALS['TYPO3_REQUEST']->getParsedBody()[Parameter::PID] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null) { + $configuredPid = (int)($GLOBALS['TYPO3_REQUEST']->getParsedBody()[Parameter::PID] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null); } else { // Get pid from User TSConfig if any. $result = $this->getBackendUser()->getTSConfig()['tx_vidi.']['dataType.'][$this->dataType.'.']['storagePid']; @@ -183,13 +183,7 @@ protected function getPage(int $configuredPid): ?array $query->getRestrictions()->removeAll(); // we are in BE context. $page = $query->select('doktype') - ->from('pages') - ->where( - 'deleted = 0', - 'uid = ' . $configuredPid - ) - ->execute() - ->fetch(); + ->from('pages')->where('deleted = 0', 'uid = ' . $configuredPid)->executeQuery()->fetchAssociative(); return is_array($page) ? $page @@ -203,7 +197,7 @@ protected function getPage(int $configuredPid): ?array protected function getQueryBuilder($tableName): QueryBuilder { /** @var ConnectionPool $connectionPool */ - $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); + $connectionPool = $this->connectionPool; return $connectionPool->getQueryBuilderForTable($tableName); } diff --git a/Classes/Module/ModulePreferences.php b/Classes/Module/ModulePreferences.php index 53b20c9..e1f1df8 100644 --- a/Classes/Module/ModulePreferences.php +++ b/Classes/Module/ModulePreferences.php @@ -89,7 +89,7 @@ public function getSignature($dataType = '') * @param string $dataType * @return void */ - public function load($dataType) + public function load($dataType): void { // Fetch preferences from different sources and overlay them $databasePreferences = $this->fetchPreferencesFromDatabase($dataType); @@ -106,7 +106,7 @@ public function load($dataType) * @param array $preferences * @return void */ - public function save($preferences) + public function save($preferences): void { $configurableParts = ConfigurablePart::getParts(); diff --git a/Classes/Mvc/JsonResult.php b/Classes/Mvc/JsonResult.php index bc18637..ee1f624 100644 --- a/Classes/Mvc/JsonResult.php +++ b/Classes/Mvc/JsonResult.php @@ -42,7 +42,7 @@ class JsonResult /** * @return $this */ - public function incrementNumberOfProcessedObjects() + public function incrementNumberOfProcessedObjects(): void { $this->numberOfProcessedObjects++; } diff --git a/Classes/Persistence/MatcherObjectFactory.php b/Classes/Persistence/MatcherObjectFactory.php index 66f8043..87b3fe6 100644 --- a/Classes/Persistence/MatcherObjectFactory.php +++ b/Classes/Persistence/MatcherObjectFactory.php @@ -75,10 +75,10 @@ public function getMatcher(array $matches = [], $dataType = ''): Matcher */ protected function applyCriteriaFromUrl(Matcher $matcher): Matcher { - if (GeneralUtility::_GP('id') + if (($GLOBALS['TYPO3_REQUEST']->getParsedBody()['id'] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()['id'] ?? null) && !$this->getModuleLoader()->isPidIgnored() && $this->getModuleLoader()->getMainModule() !== ModuleName::FILE) { - $matcher->equals('pid', GeneralUtility::_GP('id')); + $matcher->equals('pid', $GLOBALS['TYPO3_REQUEST']->getParsedBody()['id'] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()['id'] ?? null); } return $matcher; @@ -142,7 +142,7 @@ protected function applyCriteriaFromDataTables(Matcher $matcher): Matcher { // Special case for Grid in the BE using jQuery DataTables plugin. // Retrieve a possible search term from GP. - $query = GeneralUtility::_GP('search'); + $query = $GLOBALS['TYPO3_REQUEST']->getParsedBody()['search'] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()['search'] ?? null; if (is_array($query)) { if (!empty($query['value'])) { $query = $query['value']; diff --git a/Classes/Persistence/Order.php b/Classes/Persistence/Order.php index 76c4793..0a50922 100644 --- a/Classes/Persistence/Order.php +++ b/Classes/Persistence/Order.php @@ -41,7 +41,7 @@ public function __construct($orders = array()) * @param string $direction ASC / DESC * @return void */ - public function addOrdering($order, $direction) + public function addOrdering($order, $direction): void { $this->orderings[$order] = $direction; } diff --git a/Classes/Persistence/OrderObjectFactory.php b/Classes/Persistence/OrderObjectFactory.php index b4b6833..87a047a 100644 --- a/Classes/Persistence/OrderObjectFactory.php +++ b/Classes/Persistence/OrderObjectFactory.php @@ -40,7 +40,7 @@ public function getOrder($dataType = '') $order = Tca::table($dataType)->getDefaultOrderings(); // Retrieve a possible id of the column from the request - $orderings = GeneralUtility::_GP('order'); + $orderings = $GLOBALS['TYPO3_REQUEST']->getParsedBody()['order'] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()['order'] ?? null; if (is_array($orderings) && isset($orderings[0])) { $columnPosition = $orderings[0]['column']; diff --git a/Classes/Persistence/Pager.php b/Classes/Persistence/Pager.php index b1c4d5e..c1e75a6 100644 --- a/Classes/Persistence/Pager.php +++ b/Classes/Persistence/Pager.php @@ -67,7 +67,7 @@ public function getCount() * * @param int $count */ - public function setCount($count) + public function setCount($count): void { $this->count = $count; } @@ -87,7 +87,7 @@ public function getPage() * * @param int $page */ - public function setPage($page) + public function setPage($page): void { $this->page = $page; } @@ -107,7 +107,7 @@ public function getLimit() * * @param int $limit */ - public function setLimit($limit) + public function setLimit($limit): void { $this->limit = $limit; } @@ -176,7 +176,7 @@ public function getOffset() /** * @param int $offset */ - public function setOffset($offset) + public function setOffset($offset): void { $this->offset = $offset; } diff --git a/Classes/Persistence/PagerObjectFactory.php b/Classes/Persistence/PagerObjectFactory.php index 9e1c598..81a4b45 100644 --- a/Classes/Persistence/PagerObjectFactory.php +++ b/Classes/Persistence/PagerObjectFactory.php @@ -38,15 +38,15 @@ public function getPager() $pager = GeneralUtility::makeInstance(Pager::class); // Set items per page - if (GeneralUtility::_GET('length') !== null) { - $limit = (int)GeneralUtility::_GET('length'); + if (($GLOBALS['TYPO3_REQUEST']->getQueryParams()['length'] ?? null) !== null) { + $limit = (int)($GLOBALS['TYPO3_REQUEST']->getQueryParams()['length'] ?? null); $pager->setLimit($limit); } // Set offset $offset = 0; - if (GeneralUtility::_GET('start') !== null) { - $offset = (int)GeneralUtility::_GET('start'); + if (($GLOBALS['TYPO3_REQUEST']->getQueryParams()['start'] ?? null) !== null) { + $offset = (int)($GLOBALS['TYPO3_REQUEST']->getQueryParams()['start'] ?? null); } $pager->setOffset($offset); diff --git a/Classes/Persistence/Query.php b/Classes/Persistence/Query.php index e6410e4..5745341 100644 --- a/Classes/Persistence/Query.php +++ b/Classes/Persistence/Query.php @@ -150,7 +150,7 @@ public function injectTypo3QuerySettings(Typo3QuerySettings $querySettings): voi * @param QuerySettingsInterface $typo3QuerySettings The Query Settings * @return void */ - public function setTypo3QuerySettings(QuerySettingsInterface $typo3QuerySettings) + public function setTypo3QuerySettings(QuerySettingsInterface $typo3QuerySettings): void { $this->typo3QuerySettings = $typo3QuerySettings; } @@ -580,7 +580,7 @@ public function count() */ public function isEmpty($propertyName) { - throw new NotImplementedException(__METHOD__); + throw new NotImplementedException(__METHOD__, 8063512176); } /** diff --git a/Classes/Persistence/ResultSetStorage.php b/Classes/Persistence/ResultSetStorage.php index e6c6b33..815d976 100644 --- a/Classes/Persistence/ResultSetStorage.php +++ b/Classes/Persistence/ResultSetStorage.php @@ -39,7 +39,7 @@ public function get($querySignature) * @param array $resultSet * @internal param array $resultSets */ - public function set($querySignature, array $resultSet) + public function set($querySignature, array $resultSet): void { $this->resultSets[$querySignature] = $resultSet; } diff --git a/Classes/Persistence/Storage/VidiDbBackend.php b/Classes/Persistence/Storage/VidiDbBackend.php index abddefa..945e0d1 100644 --- a/Classes/Persistence/Storage/VidiDbBackend.php +++ b/Classes/Persistence/Storage/VidiDbBackend.php @@ -88,7 +88,7 @@ class VidiDbBackend /** * @param Query $query */ - public function __construct(Query $query) + public function __construct(Query $query, private readonly \TYPO3\CMS\Core\Context\Context $context, private readonly \TYPO3\CMS\Core\Database\ConnectionPool $connectionPool) { $this->query = $query; } @@ -168,9 +168,7 @@ public function countResult() $sql = $this->buildQuery($statementParts); $count = $this - ->getConnection() - ->executeQuery($sql, $parameters, $types) - ->fetchColumn(0); + ->getConnection()->executeQuery($sql, $parameters, $types)->fetchOne(0); } return (int)$count; } @@ -912,7 +910,7 @@ protected function doLanguageAndWorkspaceOverlay(array $row, $querySettings) $pageRepository = $this->getPageRepository(); if (isset($GLOBALS['TSFE']) && is_object($GLOBALS['TSFE'])) { - $languageMode = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('language', 'legacyLanguageMode'); + $languageMode = $this->context->getPropertyFromAspect('language', 'legacyLanguageMode'); #if ($this->isBackendUserLogged() && $this->getBackendUser()->workspace !== 0) { # $pageRepository->versioningWorkspaceId = $this->getBackendUser()->workspace; #} @@ -935,13 +933,7 @@ protected function doLanguageAndWorkspaceOverlay(array $row, $querySettings) $queryBuilder = $this->getQueryBuilder(); $row = $queryBuilder ->select($tableName . '.*') - ->from($tableName) - ->andWhere( - $tableName . '.uid=' . (int)$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']], - $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . ' = 0' - ) - ->execute() - ->fetch(); + ->from($tableName)->andWhere($tableName . '.uid=' . (int)$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']], $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . ' = 0')->executeQuery()->fetchAssociative(); } } @@ -1072,7 +1064,7 @@ protected function getFieldPathResolver() protected function getConnection(): Connection { /** @var ConnectionPool $connectionPool */ - return GeneralUtility::makeInstance(ConnectionPool::class) + return $this->connectionPool ->getConnectionForTable($this->getTableName()); } @@ -1082,7 +1074,7 @@ protected function getConnection(): Connection protected function getQueryBuilder(): QueryBuilder { /** @var ConnectionPool $connectionPool */ - $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); + $connectionPool = $this->connectionPool; return $connectionPool->getQueryBuilderForTable($this->getTableName()); } diff --git a/Classes/Service/BackendUserPreferenceService.php b/Classes/Service/BackendUserPreferenceService.php index 250b1f5..be52646 100644 --- a/Classes/Service/BackendUserPreferenceService.php +++ b/Classes/Service/BackendUserPreferenceService.php @@ -48,7 +48,7 @@ public function get($key) * @param mixed $value * @return void */ - public function set($key, $value) + public function set($key, $value): void { if ($this->getBackendUser()) { $this->getBackendUser()->uc[$key] = $value; diff --git a/Classes/Service/ClipboardService.php b/Classes/Service/ClipboardService.php index 0022eb3..9f1e3c4 100644 --- a/Classes/Service/ClipboardService.php +++ b/Classes/Service/ClipboardService.php @@ -56,7 +56,7 @@ public function hasItems() * * @param Matcher $matches */ - public function save(Matcher $matches) + public function save(Matcher $matches): void { $this->getBackendUser()->pushModuleData($this->getDataKey(), $matches); } @@ -66,7 +66,7 @@ public function save(Matcher $matches) * * @return void */ - public function flush() + public function flush(): void { $this->getBackendUser()->pushModuleData($this->getDataKey(), null); } diff --git a/Classes/Service/DataService.php b/Classes/Service/DataService.php index adffc0c..d863a1d 100644 --- a/Classes/Service/DataService.php +++ b/Classes/Service/DataService.php @@ -17,6 +17,9 @@ */ class DataService implements SingletonInterface { + public function __construct(private readonly \TYPO3\CMS\Core\Database\ConnectionPool $connectionPool) + { + } public function getRecord(string $tableName, array $demand = [], array $restrictions = []): array { $queryBuilder = $this->getQueryBuilder($tableName); @@ -146,14 +149,14 @@ protected function addDemandConstraints(array $demand, $queryBuilder): void protected function getConnection(string $tableName): Connection { /** @var ConnectionPool $connectionPool */ - $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); + $connectionPool = $this->connectionPool; return $connectionPool->getConnectionForTable($tableName); } protected function getQueryBuilder(string $tableName): QueryBuilder { /** @var ConnectionPool $connectionPool */ - $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); + $connectionPool = $this->connectionPool; return $connectionPool->getQueryBuilderForTable($tableName); } } diff --git a/Classes/Service/SpreadSheetService.php b/Classes/Service/SpreadSheetService.php index b21cc5d..cd14aa1 100644 --- a/Classes/Service/SpreadSheetService.php +++ b/Classes/Service/SpreadSheetService.php @@ -52,7 +52,7 @@ public function __construct() /** * @param array $row */ - public function addRow($row) + public function addRow($row): void { $this->addToBuffer($this->generateRow($row)); } diff --git a/Classes/Tca/FieldService.php b/Classes/Tca/FieldService.php index 2627bf4..02ab45e 100644 --- a/Classes/Tca/FieldService.php +++ b/Classes/Tca/FieldService.php @@ -768,7 +768,7 @@ public function getCompositeField() /** * @param string $compositeField */ - public function setCompositeField($compositeField) + public function setCompositeField($compositeField): void { $this->compositeField = $compositeField; } diff --git a/Classes/Utility/BackendUtility.php b/Classes/Utility/BackendUtility.php index a6822f9..7d0e25b 100644 --- a/Classes/Utility/BackendUtility.php +++ b/Classes/Utility/BackendUtility.php @@ -67,8 +67,8 @@ public static function BEenableFields($table, $inv = false) $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class) ->getConnectionForTable($table) ->getExpressionBuilder(); - $query = $expressionBuilder->andX(); - $invQuery = $expressionBuilder->orX(); + $query = $expressionBuilder->and(); + $invQuery = $expressionBuilder->or(); if (is_array($ctrl)) { if (is_array($ctrl['enablecolumns'])) { @@ -81,25 +81,16 @@ public static function BEenableFields($table, $inv = false) $field = $table . '.' . $ctrl['enablecolumns']['starttime']; $query->add($expressionBuilder->lte($field, (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp'))); $invQuery->add( - $expressionBuilder->andX( - $expressionBuilder->neq($field, 0), - $expressionBuilder->gt($field, (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp')) - ) + $expressionBuilder->and($expressionBuilder->neq($field, 0), $expressionBuilder->gt($field, (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp'))) ); } if ($ctrl['enablecolumns']['endtime'] ?? false) { $field = $table . '.' . $ctrl['enablecolumns']['endtime']; $query->add( - $expressionBuilder->orX( - $expressionBuilder->eq($field, 0), - $expressionBuilder->gt($field, (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp')) - ) + $expressionBuilder->or($expressionBuilder->eq($field, 0), $expressionBuilder->gt($field, (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp'))) ); $invQuery->add( - $expressionBuilder->andX( - $expressionBuilder->neq($field, 0), - $expressionBuilder->lte($field, (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp')) - ) + $expressionBuilder->and($expressionBuilder->neq($field, 0), $expressionBuilder->lte($field, (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp'))) ); } } diff --git a/Classes/View/Button/NewButton.php b/Classes/View/Button/NewButton.php index 193f4f3..848b36d 100644 --- a/Classes/View/Button/NewButton.php +++ b/Classes/View/Button/NewButton.php @@ -52,8 +52,8 @@ protected function getUriWizardNew(): string $arguments['returnUrl'] = $this->getModuleLoader()->getModuleUrl(); // Add possible id parameter - if (GeneralUtility::_GP(Parameter::PID)) { - $arguments['id'] = GeneralUtility::_GP(Parameter::PID); + if ($GLOBALS['TYPO3_REQUEST']->getParsedBody()[Parameter::PID] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null) { + $arguments['id'] = $GLOBALS['TYPO3_REQUEST']->getParsedBody()[Parameter::PID] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null; } $uri = BackendUtility::getModuleUrl( @@ -100,8 +100,8 @@ protected function getNewParameterName(): string */ protected function getStoragePid(): int { - if (GeneralUtility::_GP(Parameter::PID)) { - $pid = GeneralUtility::_GP(Parameter::PID); + if ($GLOBALS['TYPO3_REQUEST']->getParsedBody()[Parameter::PID] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null) { + $pid = $GLOBALS['TYPO3_REQUEST']->getParsedBody()[Parameter::PID] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()[Parameter::PID] ?? null; } elseif ((int)Tca::table()->get('rootLevel') === 1) { $pid = 0; } else { diff --git a/Classes/View/Grid/Row.php b/Classes/View/Grid/Row.php index a7fa8f5..90285d1 100644 --- a/Classes/View/Grid/Row.php +++ b/Classes/View/Grid/Row.php @@ -382,7 +382,7 @@ protected function getLocalizedUri($language) { // Transmit recursive selection parameter. $parameterPrefix = $this->getModuleLoader()->getParameterPrefix(); - $parameters = GeneralUtility::_GP($parameterPrefix); + $parameters = $GLOBALS['TYPO3_REQUEST']->getParsedBody()[$parameterPrefix] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()[$parameterPrefix] ?? null; $additionalParameters = array( $this->getModuleLoader()->getParameterPrefix() => array( diff --git a/Classes/ViewHelpers/Be/AdditionalAssetsViewHelper.php b/Classes/ViewHelpers/Be/AdditionalAssetsViewHelper.php index 521c6b9..d0f9098 100644 --- a/Classes/ViewHelpers/Be/AdditionalAssetsViewHelper.php +++ b/Classes/ViewHelpers/Be/AdditionalAssetsViewHelper.php @@ -28,7 +28,7 @@ class AdditionalAssetsViewHelper extends AbstractBackendViewHelper * @return void * @api */ - public function render() + public function render(): void { $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); /** @var ModuleLoader $moduleLoader */ diff --git a/Classes/ViewHelpers/Be/RequireJsViewHelper.php b/Classes/ViewHelpers/Be/RequireJsViewHelper.php index 77cffb1..60a17d7 100644 --- a/Classes/ViewHelpers/Be/RequireJsViewHelper.php +++ b/Classes/ViewHelpers/Be/RequireJsViewHelper.php @@ -24,7 +24,7 @@ class RequireJsViewHelper extends AbstractBackendViewHelper * * @return void */ - public function render() + public function render(): void { $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); diff --git a/Classes/ViewHelpers/Button/ToolWorkViewHelper.php b/Classes/ViewHelpers/Button/ToolWorkViewHelper.php index 8b3c372..8ee9025 100644 --- a/Classes/ViewHelpers/Button/ToolWorkViewHelper.php +++ b/Classes/ViewHelpers/Button/ToolWorkViewHelper.php @@ -20,7 +20,7 @@ class ToolWorkViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('tool', 'string', '', true); $this->registerArgument('label', 'string', '', true); diff --git a/Classes/ViewHelpers/Content/AbstractContentViewHelper.php b/Classes/ViewHelpers/Content/AbstractContentViewHelper.php index f3bf40c..f9fd2d2 100644 --- a/Classes/ViewHelpers/Content/AbstractContentViewHelper.php +++ b/Classes/ViewHelpers/Content/AbstractContentViewHelper.php @@ -31,7 +31,7 @@ abstract class AbstractContentViewHelper extends AbstractViewHelper * @return void * @throws Exception */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('type', 'string', 'Corresponds to the type of data to be fetched. It will basically be a table name e.g. fe_users.', false, ''); $this->registerArgument('matches', 'array', 'Key / value array to be used as filter. The key corresponds to a field name.', false, array()); diff --git a/Classes/ViewHelpers/Content/FindOneViewHelper.php b/Classes/ViewHelpers/Content/FindOneViewHelper.php index 515936c..c786b68 100644 --- a/Classes/ViewHelpers/Content/FindOneViewHelper.php +++ b/Classes/ViewHelpers/Content/FindOneViewHelper.php @@ -25,7 +25,7 @@ class FindOneViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { parent::initializeArguments(); @@ -160,8 +160,8 @@ protected static function getArgumentValue($argumentName) $value = ''; // default value // Merge parameters - $parameters = GeneralUtility::_GET(); - $post = GeneralUtility::_POST(); + $parameters = $GLOBALS['TYPO3_REQUEST']->getQueryParams(); + $post = $GLOBALS['TYPO3_REQUEST']->getParsedBody(); ArrayUtility::mergeRecursiveWithOverrule($parameters, $post); // Traverse argument parts and retrieve value. diff --git a/Classes/ViewHelpers/Content/FindViewHelper.php b/Classes/ViewHelpers/Content/FindViewHelper.php index 3757786..7682b77 100644 --- a/Classes/ViewHelpers/Content/FindViewHelper.php +++ b/Classes/ViewHelpers/Content/FindViewHelper.php @@ -23,7 +23,7 @@ class FindViewHelper extends AbstractContentViewHelper * @return void * @throws Exception */ - public function initializeArguments() + public function initializeArguments(): void { parent::initializeArguments(); diff --git a/Classes/ViewHelpers/GpViewHelper.php b/Classes/ViewHelpers/GpViewHelper.php index 6e03214..d3210dd 100644 --- a/Classes/ViewHelpers/GpViewHelper.php +++ b/Classes/ViewHelpers/GpViewHelper.php @@ -21,7 +21,7 @@ class GpViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('argument', 'string', 'The argument name', true); $this->registerArgument('encode', 'bool', 'Whether to encode the URL.', false, true); @@ -37,8 +37,8 @@ public function render() $value = ''; // default value // Merge parameters - $parameters = GeneralUtility::_GET(); - $post = GeneralUtility::_POST(); + $parameters = $GLOBALS['TYPO3_REQUEST']->getQueryParams(); + $post = $GLOBALS['TYPO3_REQUEST']->getParsedBody(); ArrayUtility::mergeRecursiveWithOverrule($parameters, $post); // Traverse argument parts and retrieve value. diff --git a/Classes/ViewHelpers/Grid/Column/CanBeHiddenViewHelper.php b/Classes/ViewHelpers/Grid/Column/CanBeHiddenViewHelper.php index 55dfd5a..3222163 100644 --- a/Classes/ViewHelpers/Grid/Column/CanBeHiddenViewHelper.php +++ b/Classes/ViewHelpers/Grid/Column/CanBeHiddenViewHelper.php @@ -20,7 +20,7 @@ class CanBeHiddenViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('name', 'string', 'The column name', true); } diff --git a/Classes/ViewHelpers/Grid/Column/HeaderViewHelper.php b/Classes/ViewHelpers/Grid/Column/HeaderViewHelper.php index a665319..1f260ff 100644 --- a/Classes/ViewHelpers/Grid/Column/HeaderViewHelper.php +++ b/Classes/ViewHelpers/Grid/Column/HeaderViewHelper.php @@ -20,7 +20,7 @@ class HeaderViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('name', 'string', 'The column name', true); } diff --git a/Classes/ViewHelpers/Grid/Column/IsEditableViewHelper.php b/Classes/ViewHelpers/Grid/Column/IsEditableViewHelper.php index 4a60a7d..32a1faf 100644 --- a/Classes/ViewHelpers/Grid/Column/IsEditableViewHelper.php +++ b/Classes/ViewHelpers/Grid/Column/IsEditableViewHelper.php @@ -20,7 +20,7 @@ class IsEditableViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('name', 'string', 'The column name', true); } diff --git a/Classes/ViewHelpers/Grid/Column/IsExcludedViewHelper.php b/Classes/ViewHelpers/Grid/Column/IsExcludedViewHelper.php index a8fe8c0..9ac334b 100644 --- a/Classes/ViewHelpers/Grid/Column/IsExcludedViewHelper.php +++ b/Classes/ViewHelpers/Grid/Column/IsExcludedViewHelper.php @@ -20,7 +20,7 @@ class IsExcludedViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('name', 'string', 'The column name', true); } diff --git a/Classes/ViewHelpers/Grid/Column/IsVisibleViewHelper.php b/Classes/ViewHelpers/Grid/Column/IsVisibleViewHelper.php index 780b8de..f216cc3 100644 --- a/Classes/ViewHelpers/Grid/Column/IsVisibleViewHelper.php +++ b/Classes/ViewHelpers/Grid/Column/IsVisibleViewHelper.php @@ -20,7 +20,7 @@ class IsVisibleViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('name', 'string', 'The column name', true); } diff --git a/Classes/ViewHelpers/Grid/PreferencesViewHelper.php b/Classes/ViewHelpers/Grid/PreferencesViewHelper.php index fb805d3..9ef9fb9 100644 --- a/Classes/ViewHelpers/Grid/PreferencesViewHelper.php +++ b/Classes/ViewHelpers/Grid/PreferencesViewHelper.php @@ -21,7 +21,7 @@ class PreferencesViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('key', 'string', '', true); } diff --git a/Classes/ViewHelpers/IsRelatedToViewHelper.php b/Classes/ViewHelpers/IsRelatedToViewHelper.php index 0ae65a5..0b3ffde 100644 --- a/Classes/ViewHelpers/IsRelatedToViewHelper.php +++ b/Classes/ViewHelpers/IsRelatedToViewHelper.php @@ -21,7 +21,7 @@ class IsRelatedToViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('relatedContent', Content::class, 'The related content', true); } diff --git a/Classes/ViewHelpers/Link/BackViewHelper.php b/Classes/ViewHelpers/Link/BackViewHelper.php index aefd84c..82c3324 100644 --- a/Classes/ViewHelpers/Link/BackViewHelper.php +++ b/Classes/ViewHelpers/Link/BackViewHelper.php @@ -27,10 +27,10 @@ class BackViewHelper extends AbstractViewHelper public function render() { $result = ''; - if (GeneralUtility::_GET('returnUrl')) { + if ($GLOBALS['TYPO3_REQUEST']->getQueryParams()['returnUrl'] ?? null) { $result = sprintf( '%s', - GeneralUtility::_GP('returnUrl'), + $GLOBALS['TYPO3_REQUEST']->getParsedBody()['returnUrl'] ?? $GLOBALS['TYPO3_REQUEST']->getQueryParams()['returnUrl'] ?? null, $this->getIconFactory()->getIcon('actions-close', Icon::SIZE_SMALL) ); } diff --git a/Classes/ViewHelpers/ModuleLoaderViewHelper.php b/Classes/ViewHelpers/ModuleLoaderViewHelper.php index b8637d7..d473fcf 100644 --- a/Classes/ViewHelpers/ModuleLoaderViewHelper.php +++ b/Classes/ViewHelpers/ModuleLoaderViewHelper.php @@ -21,7 +21,7 @@ class ModuleLoaderViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('key', 'string', 'The module key', true); } diff --git a/Classes/ViewHelpers/ModulePreferencesViewHelper.php b/Classes/ViewHelpers/ModulePreferencesViewHelper.php index a5b20b4..faa8c27 100644 --- a/Classes/ViewHelpers/ModulePreferencesViewHelper.php +++ b/Classes/ViewHelpers/ModulePreferencesViewHelper.php @@ -21,7 +21,7 @@ class ModulePreferencesViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('key', 'string', 'The module key', true); } diff --git a/Classes/ViewHelpers/Render/ComponentsViewHelper.php b/Classes/ViewHelpers/Render/ComponentsViewHelper.php index 3bc72d3..302b027 100644 --- a/Classes/ViewHelpers/Render/ComponentsViewHelper.php +++ b/Classes/ViewHelpers/Render/ComponentsViewHelper.php @@ -22,7 +22,7 @@ class ComponentsViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('part', 'string', 'Template part', true); } diff --git a/Classes/ViewHelpers/Result/ToCsvViewHelper.php b/Classes/ViewHelpers/Result/ToCsvViewHelper.php index e573cd6..2aa205a 100644 --- a/Classes/ViewHelpers/Result/ToCsvViewHelper.php +++ b/Classes/ViewHelpers/Result/ToCsvViewHelper.php @@ -23,7 +23,7 @@ class ToCsvViewHelper extends AbstractToFormatViewHelper /** * Render a CSV export request. */ - public function render() + public function render(): void { $objects = $this->templateVariableContainer->get('objects'); diff --git a/Classes/ViewHelpers/Result/ToJsonViewHelper.php b/Classes/ViewHelpers/Result/ToJsonViewHelper.php index e1cf5b4..13b67bc 100644 --- a/Classes/ViewHelpers/Result/ToJsonViewHelper.php +++ b/Classes/ViewHelpers/Result/ToJsonViewHelper.php @@ -22,7 +22,7 @@ class ToJsonViewHelper extends AbstractResultViewHelper /** * Render a Json response */ - public function render() + public function render(): void { $objects = $this->templateVariableContainer->get('objects'); $columns = $this->templateVariableContainer->get('columns'); @@ -43,8 +43,8 @@ public function render() protected function getNextTransactionId() { $transaction = 0; - if (GeneralUtility::_GET('sEcho')) { - $transaction = (int)GeneralUtility::_GET('sEcho') + 1; + if ($GLOBALS['TYPO3_REQUEST']->getQueryParams()['sEcho'] ?? null) { + $transaction = (int)($GLOBALS['TYPO3_REQUEST']->getQueryParams()['sEcho'] ?? null) + 1; } return $transaction; } diff --git a/Classes/ViewHelpers/Result/ToXlsViewHelper.php b/Classes/ViewHelpers/Result/ToXlsViewHelper.php index 3d6527b..b30e469 100644 --- a/Classes/ViewHelpers/Result/ToXlsViewHelper.php +++ b/Classes/ViewHelpers/Result/ToXlsViewHelper.php @@ -21,7 +21,7 @@ class ToXlsViewHelper extends AbstractToFormatViewHelper /** * Render a XLS export request. */ - public function render() + public function render(): void { $objects = $this->templateVariableContainer->get('objects'); diff --git a/Classes/ViewHelpers/Result/ToXmlViewHelper.php b/Classes/ViewHelpers/Result/ToXmlViewHelper.php index d40c097..d045d84 100644 --- a/Classes/ViewHelpers/Result/ToXmlViewHelper.php +++ b/Classes/ViewHelpers/Result/ToXmlViewHelper.php @@ -20,7 +20,7 @@ class ToXmlViewHelper extends AbstractToFormatViewHelper /** * Render an XML export. */ - public function render() + public function render(): void { $objects = $this->templateVariableContainer->get('objects'); diff --git a/Classes/ViewHelpers/SpriteViewHelper.php b/Classes/ViewHelpers/SpriteViewHelper.php index 1c25d4f..c8e419e 100644 --- a/Classes/ViewHelpers/SpriteViewHelper.php +++ b/Classes/ViewHelpers/SpriteViewHelper.php @@ -22,7 +22,7 @@ class SpriteViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('name', 'string', 'the file to include', true); } diff --git a/Classes/ViewHelpers/Tca/LabelViewHelper.php b/Classes/ViewHelpers/Tca/LabelViewHelper.php index 3c8d278..14d6f8c 100644 --- a/Classes/ViewHelpers/Tca/LabelViewHelper.php +++ b/Classes/ViewHelpers/Tca/LabelViewHelper.php @@ -20,7 +20,7 @@ class LabelViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('dataType', 'string', '', true); $this->registerArgument('fieldName', 'string', '', true); diff --git a/Classes/ViewHelpers/Tca/TableViewHelper.php b/Classes/ViewHelpers/Tca/TableViewHelper.php index aa229db..27d49ba 100644 --- a/Classes/ViewHelpers/Tca/TableViewHelper.php +++ b/Classes/ViewHelpers/Tca/TableViewHelper.php @@ -20,7 +20,7 @@ class TableViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('key', 'string', '', true); $this->registerArgument('dataType', 'string', '', false, ''); diff --git a/Classes/ViewHelpers/Tca/TitleViewHelper.php b/Classes/ViewHelpers/Tca/TitleViewHelper.php index 8665a15..25fda5e 100644 --- a/Classes/ViewHelpers/Tca/TitleViewHelper.php +++ b/Classes/ViewHelpers/Tca/TitleViewHelper.php @@ -21,7 +21,7 @@ class TitleViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('content', Content::class, '', true); } diff --git a/Classes/ViewHelpers/UserPreferencesViewHelper.php b/Classes/ViewHelpers/UserPreferencesViewHelper.php index bc305fd..16043f2 100644 --- a/Classes/ViewHelpers/UserPreferencesViewHelper.php +++ b/Classes/ViewHelpers/UserPreferencesViewHelper.php @@ -28,7 +28,7 @@ class UserPreferencesViewHelper extends AbstractViewHelper /** * @return void */ - public function initializeArguments() + public function initializeArguments(): void { $this->registerArgument('key', 'string', '', true); } diff --git a/Tests/Feature/bootstrap/FeatureContext.php b/Tests/Feature/bootstrap/FeatureContext.php index af959cc..f7af55e 100644 --- a/Tests/Feature/bootstrap/FeatureContext.php +++ b/Tests/Feature/bootstrap/FeatureContext.php @@ -23,7 +23,7 @@ public function __construct(array $parameters) /** * @Given /^I wait "([^"]*)" seconds$/ */ - public function iWaitSeconds($seconds) + public function iWaitSeconds($seconds): void { sleep($seconds); } diff --git a/Tests/Functional/Domain/Model/ContentTest.php b/Tests/Functional/Domain/Model/ContentTest.php index e33019e..baccdcb 100644 --- a/Tests/Functional/Domain/Model/ContentTest.php +++ b/Tests/Functional/Domain/Model/ContentTest.php @@ -44,7 +44,7 @@ public function setUp() $this->fixture = new Content($this->dataType); } - public function tearDown() + public function tearDown(): void { unset($this->fixture, $GLOBALS['TCA'][$this->dataType]); } @@ -53,7 +53,7 @@ public function tearDown() * @test * @dataProvider fieldNameProvider */ - public function fieldNameIsConvertedToPropertyName($fieldName, $propertyName) + public function fieldNameIsConvertedToPropertyName($fieldName, $propertyName): void { $data = array( $fieldName => 'foo data', @@ -66,7 +66,7 @@ public function fieldNameIsConvertedToPropertyName($fieldName, $propertyName) * @test * @dataProvider fieldNameProvider */ - public function accessValueOfArrayObjectReturnsFooDataAsString($fieldName) + public function accessValueOfArrayObjectReturnsFooDataAsString($fieldName): void { $data = array( $fieldName => 'foo data', @@ -80,7 +80,7 @@ public function accessValueOfArrayObjectReturnsFooDataAsString($fieldName) * @test * @dataProvider fieldNameProvider */ - public function getValueThroughGetterReturnsFooDataAsString($fieldName, $propertyName) + public function getValueThroughGetterReturnsFooDataAsString($fieldName, $propertyName): void { $data = array( $fieldName => 'foo data', @@ -95,7 +95,7 @@ public function getValueThroughGetterReturnsFooDataAsString($fieldName, $propert * @test * @dataProvider fieldNameProvider */ - public function toArrayMethodContainsGivenFieldName($fieldName) + public function toArrayMethodContainsGivenFieldName($fieldName): void { $data = array( $fieldName => 'foo data', @@ -120,7 +120,7 @@ public function fieldNameProvider() * @test * @dataProvider propertyProvider */ - public function testProperty($propertyName, $value) + public function testProperty($propertyName, $value): void { $setter = 'set' . ucfirst($propertyName); $getter = 'get' . ucfirst($propertyName); diff --git a/Tests/Functional/Grid/RelationRendererTest.php b/Tests/Functional/Grid/RelationRendererTest.php index b5a6cef..03e32a8 100644 --- a/Tests/Functional/Grid/RelationRendererTest.php +++ b/Tests/Functional/Grid/RelationRendererTest.php @@ -49,7 +49,7 @@ public function setUp() $this->fixture = new RelationRenderer(); } - public function tearDown() + public function tearDown(): void { unset($this->fixture, $GLOBALS['_GET']['M']); } @@ -57,7 +57,7 @@ public function tearDown() /** * @test */ - public function renderAssetWithNoCategoryReturnsEmpty() + public function renderAssetWithNoCategoryReturnsEmpty(): void { $content = new Content($this->dataType); $this->markTestIncomplete(); # TCA must be faked diff --git a/Tests/Functional/Module/ModuleLoaderTest.php b/Tests/Functional/Module/ModuleLoaderTest.php index 177d223..c17a41b 100644 --- a/Tests/Functional/Module/ModuleLoaderTest.php +++ b/Tests/Functional/Module/ModuleLoaderTest.php @@ -47,7 +47,7 @@ public function setUp() $this->fixture->register(); } - public function tearDown() + public function tearDown(): void { unset($this->fixture); } @@ -56,7 +56,7 @@ public function tearDown() * @test * @dataProvider attributeValueProvider */ - public function attributeCanBeSet($attribute, $value) + public function attributeCanBeSet($attribute, $value): void { $setter = 'set' . ucfirst($attribute); $this->fixture->$setter($value); @@ -78,7 +78,7 @@ public function attributeValueProvider() * @test * @dataProvider attributeProvider */ - public function testAttribute($attribute, $defaultValue) + public function testAttribute($attribute, $defaultValue): void { $this->assertAttributeEquals($defaultValue, $attribute, $this->fixture); } @@ -98,7 +98,7 @@ public function attributeProvider() /** * @test */ - public function getModuleConfigurationReturnsArrayWithSomeKeys() + public function getModuleConfigurationReturnsArrayWithSomeKeys(): void { $moduleLoader = new ModuleLoader($this->dataType); $moduleLoader->register(); @@ -114,7 +114,7 @@ public function getModuleConfigurationReturnsArrayWithSomeKeys() /** * @test */ - public function getModuleConfigurationWithParameterDataTypeReturnsDataType() + public function getModuleConfigurationWithParameterDataTypeReturnsDataType(): void { $moduleLoader = new ModuleLoader($this->dataType); $moduleLoader->register(); diff --git a/Tests/Unit/Formatter/DateTest.php b/Tests/Unit/Formatter/DateTest.php index 3ad9599..b7be9dd 100644 --- a/Tests/Unit/Formatter/DateTest.php +++ b/Tests/Unit/Formatter/DateTest.php @@ -15,14 +15,14 @@ class DateTest extends UnitTestCase */ private $subject; - public function setUp() + public function setUp(): void { date_default_timezone_set('GMT'); $this->subject = new Date(); $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] = 'd.m.Y'; } - public function tearDown() + public function tearDown(): void { unset($this->subject); } @@ -30,7 +30,7 @@ public function tearDown() /** * @test */ - public function canFormatDate() + public function canFormatDate(): void { $foo = $this->subject->format('1351880525'); $this->assertEquals('02.11.2012', $foo); diff --git a/Tests/Unit/Formatter/DatetimeTest.php b/Tests/Unit/Formatter/DatetimeTest.php index dc36e82..0688529 100644 --- a/Tests/Unit/Formatter/DatetimeTest.php +++ b/Tests/Unit/Formatter/DatetimeTest.php @@ -28,7 +28,7 @@ class DatetimeTest extends UnitTestCase */ private $subject; - public function setUp() + public function setUp(): void { date_default_timezone_set('GMT'); $this->subject = new Datetime(); @@ -36,7 +36,7 @@ public function setUp() $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'] = 'H:i'; } - public function tearDown() + public function tearDown(): void { unset($this->subject); } @@ -44,7 +44,7 @@ public function tearDown() /** * @test */ - public function canFormatDatetime() + public function canFormatDatetime(): void { $foo = $this->subject->format('1351880525'); $this->assertEquals('02.11.2012 18:22', $foo); diff --git a/Tests/Unit/Module/ModulePreferencesTest.php b/Tests/Unit/Module/ModulePreferencesTest.php index f3d8d18..f76541e 100644 --- a/Tests/Unit/Module/ModulePreferencesTest.php +++ b/Tests/Unit/Module/ModulePreferencesTest.php @@ -13,7 +13,7 @@ class ModulePreferencesTest extends UnitTestCase /** * @test */ - public function instantiateMe() + public function instantiateMe(): void { $fixture = new ModulePreferences(); $this->assertInstanceOf('Fab\Vidi\Module\ModulePreferences', $fixture); diff --git a/Tests/Unit/Tca/AbstractServiceTest.php b/Tests/Unit/Tca/AbstractServiceTest.php index 61e3787..a24e11d 100644 --- a/Tests/Unit/Tca/AbstractServiceTest.php +++ b/Tests/Unit/Tca/AbstractServiceTest.php @@ -15,7 +15,7 @@ abstract class AbstractServiceTest extends UnitTestCase */ private $fixture; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -25,7 +25,6 @@ public function setUp() 'default_sortby' => 'ORDER BY username', 'tstamp' => 'tstamp', 'crdate' => 'crdate', - 'cruser_id' => 'cruser_id', 'title' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:tx_foo', 'delete' => 'deleted', 'enablecolumns' => array( @@ -45,16 +44,16 @@ public function setUp() 'type' => 'input', 'size' => '20', 'max' => '255', - 'eval' => 'nospace,lower,uniqueInPid,required' + 'eval' => 'nospace,lower,uniqueInPid', + 'required' => true ), ), 'password' => array( 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:password', 'config' => array( - 'type' => 'input', + 'type' => 'password', 'size' => '10', - 'max' => '40', - 'eval' => 'nospace,required,password' + 'hashed' => false ), ), 'usergroup' => array( @@ -248,7 +247,7 @@ public function setUp() */ } - public function tearDown() + public function tearDown(): void { unset($this->fixture, $GLOBALS['TCA']); } diff --git a/Tests/Unit/Tca/FieldServiceTest.php b/Tests/Unit/Tca/FieldServiceTest.php index c86106a..296faff 100644 --- a/Tests/Unit/Tca/FieldServiceTest.php +++ b/Tests/Unit/Tca/FieldServiceTest.php @@ -27,13 +27,13 @@ class FieldServiceTest extends AbstractServiceTest */ private $fixture; - public function setUp() + public function setUp(): void { parent::setUp(); $this->fixture = new TableService('tx_foo'); } - public function tearDown() + public function tearDown(): void { unset($this->fixture); } @@ -41,7 +41,7 @@ public function tearDown() /** * @test */ - public function fieldsIncludesATitleFieldInTableSysFile() + public function fieldsIncludesATitleFieldInTableSysFile(): void { $actual = $this->fixture->getFields(); $this->assertTrue(is_array($actual)); @@ -51,7 +51,7 @@ public function fieldsIncludesATitleFieldInTableSysFile() /** * @test */ - public function fieldTypeReturnsInputForFieldTitleInTableSysFile() + public function fieldTypeReturnsInputForFieldTitleInTableSysFile(): void { $field = $this->fixture->field('username'); $actual = $field->getType(); @@ -61,7 +61,7 @@ public function fieldTypeReturnsInputForFieldTitleInTableSysFile() /** * @test */ - public function fieldNameMustBeRequiredByDefault() + public function fieldNameMustBeRequiredByDefault(): void { $field = $this->fixture->field('username'); $this->assertTrue($field->isRequired()); @@ -70,7 +70,7 @@ public function fieldNameMustBeRequiredByDefault() /** * @test */ - public function fieldFirstNameMustNotBeRequiredByDefault() + public function fieldFirstNameMustNotBeRequiredByDefault(): void { $field = $this->fixture->field('first_name'); $this->assertFalse($field->isRequired()); @@ -79,7 +79,7 @@ public function fieldFirstNameMustNotBeRequiredByDefault() /** * @test */ - public function getTypeForFieldStarTimeReturnsDataTime() + public function getTypeForFieldStarTimeReturnsDataTime(): void { $fieldType = $this->fixture->field('starttime')->getType(); $this->assertEquals(FieldType::DATETIME, $fieldType); @@ -89,7 +89,7 @@ public function getTypeForFieldStarTimeReturnsDataTime() * @test * @dataProvider fieldProvider */ - public function hasRelationReturnsFalseForFieldName($fieldName, $hasRelation, $hasRelationOneToMany, $hasRelationManyToMany) + public function hasRelationReturnsFalseForFieldName($fieldName, $hasRelation, $hasRelationOneToMany, $hasRelationManyToMany): void { $field = $this->fixture->field($fieldName); $this->assertEquals($hasRelation, $field->hasRelation()); diff --git a/Tests/Unit/Tca/GridServiceTest.php b/Tests/Unit/Tca/GridServiceTest.php index ee0115c..5bf80ff 100644 --- a/Tests/Unit/Tca/GridServiceTest.php +++ b/Tests/Unit/Tca/GridServiceTest.php @@ -27,7 +27,7 @@ class GridServiceTest extends AbstractServiceTest */ private $fixture; - public function setUp() + public function setUp(): void { parent::setUp(); $this->fixture = $this->getMock('Fab\Vidi\Tca\GridService', array('getModulePreferences'), array('tx_foo', Tca::TYPE_GRID)); @@ -41,7 +41,7 @@ public function setUp() $GLOBALS['BE_USER']->expects($this->any())->method('isAdmin')->will($this->returnValue(true)); } - public function tearDown() + public function tearDown(): void { unset($this->fixture); } @@ -59,7 +59,7 @@ public function tearDown() /** * @test */ - public function getFieldNamesReturnsNotEmpty() + public function getFieldNamesReturnsNotEmpty(): void { $actual = $this->fixture->getFieldNames(); @@ -71,7 +71,7 @@ public function getFieldNamesReturnsNotEmpty() /** * @test */ - public function getColumnsReturnsAnNotEmptyArray() + public function getColumnsReturnsAnNotEmptyArray(): void { $actual = $this->fixture->getFields(); $this->assertTrue(is_array($actual)); @@ -81,7 +81,7 @@ public function getColumnsReturnsAnNotEmptyArray() /** * @test */ - public function getFieldsReturnsGreaterThanNumberOfColumns() + public function getFieldsReturnsGreaterThanNumberOfColumns(): void { $actual = $this->fixture->getFields(); $this->assertGreaterThanOrEqual(count($actual), count($GLOBALS['TCA']['tx_foo']['columns'])); @@ -90,7 +90,7 @@ public function getFieldsReturnsGreaterThanNumberOfColumns() /** * @test */ - public function additionalFieldsAreHiddenByDefault() + public function additionalFieldsAreHiddenByDefault(): void { $actual = $this->fixture->getFields(); $this->assertFalse($actual['birthday']['visible']); @@ -99,7 +99,7 @@ public function additionalFieldsAreHiddenByDefault() /** * @test */ - public function additionalFieldBirthDayIsFormattedAsDate() + public function additionalFieldBirthDayIsFormattedAsDate(): void { $actual = $this->fixture->getFields(); $this->assertEquals('Fab\Vidi\Formatter\Date', $actual['birthday']['format']); @@ -108,7 +108,7 @@ public function additionalFieldBirthDayIsFormattedAsDate() /** * @test */ - public function additionalFieldStartTimeIsFormattedAsDateTime() + public function additionalFieldStartTimeIsFormattedAsDateTime(): void { $actual = $this->fixture->getFields(); $this->assertEquals('Fab\Vidi\Formatter\Datetime', $actual['starttime']['format']); @@ -117,7 +117,7 @@ public function additionalFieldStartTimeIsFormattedAsDateTime() /** * @test */ - public function getConfigurationForColumnUsername() + public function getConfigurationForColumnUsername(): void { $actual = $this->fixture->getField('username'); $this->assertTrue(is_array($actual)); @@ -127,7 +127,7 @@ public function getConfigurationForColumnUsername() /** * @test */ - public function additionalColumnFirstNameShouldNotBeVisible() + public function additionalColumnFirstNameShouldNotBeVisible(): void { $actual = $this->fixture->isVisible('first_name'); $this->assertFalse($actual); @@ -136,7 +136,7 @@ public function additionalColumnFirstNameShouldNotBeVisible() /** * @test */ - public function columnUsernameShouldBeSortableByDefault() + public function columnUsernameShouldBeSortableByDefault(): void { $this->assertTrue($this->fixture->isSortable('username')); } @@ -144,7 +144,7 @@ public function columnUsernameShouldBeSortableByDefault() /** * @test */ - public function columnNumberShouldBeNotSortableByDefault() + public function columnNumberShouldBeNotSortableByDefault(): void { $this->assertFalse($this->fixture->isSortable('usergroup')); } @@ -152,7 +152,7 @@ public function columnNumberShouldBeNotSortableByDefault() /** * @test */ - public function getExcludedFieldsReturnsArray() + public function getExcludedFieldsReturnsArray(): void { $result = $this->fixture->getExcludedFields(); $this->assertInternalType('array', $result); @@ -161,7 +161,7 @@ public function getExcludedFieldsReturnsArray() /** * @test */ - public function getFieldsRemoveFieldMiddleNameFromResultSet() + public function getFieldsRemoveFieldMiddleNameFromResultSet(): void { $result = $this->fixture->getFields(); $this->assertArrayNotHasKey('middle_name', $result); @@ -170,7 +170,7 @@ public function getFieldsRemoveFieldMiddleNameFromResultSet() /** * @test */ - public function columnUsernameShouldBeVisibleByDefault() + public function columnUsernameShouldBeVisibleByDefault(): void { $this->assertTrue($this->fixture->isVisible('username')); } @@ -178,7 +178,7 @@ public function columnUsernameShouldBeVisibleByDefault() /** * @test */ - public function getConfigurationOfNotExistingColumnReturnsAnException() + public function getConfigurationOfNotExistingColumnReturnsAnException(): void { $expected = []; $this->assertEquals($expected, $this->fixture->getRenderers('bar')); @@ -187,7 +187,7 @@ public function getConfigurationOfNotExistingColumnReturnsAnException() /** * @test */ - public function getFieldsAndCheckWhetherItsPositionReturnsTheCorrectFieldName() + public function getFieldsAndCheckWhetherItsPositionReturnsTheCorrectFieldName(): void { $fields = array_keys($this->fixture->getFields()); for ($index = 0; $index < count($fields); $index++) { @@ -199,7 +199,7 @@ public function getFieldsAndCheckWhetherItsPositionReturnsTheCorrectFieldName() /** * @test */ - public function canGetLabelKeyCodeForFakeFieldUserGroups() + public function canGetLabelKeyCodeForFakeFieldUserGroups(): void { $fieldName = 'usergroup'; $this->assertEquals($GLOBALS['TCA']['tx_foo']['grid']['columns'][$fieldName]['label'], $this->fixture->getLabelKey($fieldName)); diff --git a/Tests/Unit/Tca/TableServiceTest.php b/Tests/Unit/Tca/TableServiceTest.php index cd90d20..a4ac9e8 100644 --- a/Tests/Unit/Tca/TableServiceTest.php +++ b/Tests/Unit/Tca/TableServiceTest.php @@ -38,13 +38,13 @@ class TableServiceTest extends AbstractServiceTest */ private $fixture; - public function setUp() + public function setUp(): void { parent::setUp(); $this->fixture = new TableService('tx_foo', Tca::TYPE_TABLE); } - public function tearDown() + public function tearDown(): void { unset($this->fixture); } @@ -52,7 +52,7 @@ public function tearDown() /** * @test */ - public function getLabelReturnNameAsValue() + public function getLabelReturnNameAsValue(): void { $this->assertEquals('username', $this->fixture->getLabelField()); } @@ -60,7 +60,7 @@ public function getLabelReturnNameAsValue() /** * @test */ - public function getSearchableFieldsIsNotEmptyByDefaultForTableSysFile() + public function getSearchableFieldsIsNotEmptyByDefaultForTableSysFile(): void { $actual = $this->fixture->getSearchFields(); $this->assertNotEmpty($actual); From 942bf329f3b1ba7b1299282330fc02e0e959121b Mon Sep 17 00:00:00 2001 From: Fabien Udriot Date: Wed, 3 Dec 2025 10:26:46 +0100 Subject: [PATCH 08/11] Upgrade TYPO3 CMS core requirement to version 13 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ffefa0b..d7e6bd9 100644 --- a/composer.json +++ b/composer.json @@ -28,6 +28,6 @@ }, "require": { "php": ">=8.0", - "typo3/cms-core": "^12" + "typo3/cms-core": "^13" } } From 63fea60aa405338dc605ae33bcb05bd8a04454fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hyacinthe=20Compaor=C3=A9?= <131278191+compaoreh338@users.noreply.github.com> Date: Tue, 9 Dec 2025 21:24:20 +0000 Subject: [PATCH 09/11] FIX: warnings --- Classes/Controller/SelectionController.php | 2 +- Classes/Domain/Repository/ContentRepository.php | 6 +++--- Classes/Persistence/Storage/VidiDbBackend.php | 2 +- Classes/Service/ContentService.php | 4 ++-- Classes/TypeConverter/CsvToArrayConverter.php | 2 +- Classes/View/Button/DeleteButton.php | 2 +- Classes/View/Button/EditButton.php | 2 +- Classes/View/Grid/Row.php | 2 +- Classes/View/System/ButtonsSystem.php | 2 +- Classes/View/System/CheckboxSystem.php | 2 +- Classes/View/Uri/EditUri.php | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Classes/Controller/SelectionController.php b/Classes/Controller/SelectionController.php index f8767db..01b704c 100644 --- a/Classes/Controller/SelectionController.php +++ b/Classes/Controller/SelectionController.php @@ -25,7 +25,7 @@ class SelectionController extends ActionController /** * @param Selection $selection */ - public function createAction(Selection $selection = null) + public function createAction(?Selection $selection = null) { $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); $selection->setDataType($this->getModuleLoader()->getDataType()); diff --git a/Classes/Domain/Repository/ContentRepository.php b/Classes/Domain/Repository/ContentRepository.php index 1a01c56..8ab69f2 100644 --- a/Classes/Domain/Repository/ContentRepository.php +++ b/Classes/Domain/Repository/ContentRepository.php @@ -103,7 +103,7 @@ public function findAll() * @param Order|null $order * @return Content[] */ - public function findDistinctValues($propertyName, Matcher $matcher = null, Order $order = null): array + public function findDistinctValues($propertyName, ?Matcher $matcher = null, ?Order $order = null): array { $query = $this->createQuery(); $query->setDistinct($propertyName); @@ -138,7 +138,7 @@ public function findDistinctValues($propertyName, Matcher $matcher = null, Order * @param Matcher $matcher * @return int */ - public function countDistinctValues($propertyName, Matcher $matcher = null): int + public function countDistinctValues($propertyName, ?Matcher $matcher = null): int { $query = $this->createQuery(); $query->setDistinct($propertyName); @@ -197,7 +197,7 @@ public function findIn($propertyName, array $values): array * @param int $offset * @return Content[] */ - public function findBy(Matcher $matcher, Order $order = null, $limit = null, $offset = null): array + public function findBy(Matcher $matcher, ?Order $order = null, $limit = null, $offset = null): array { $query = $this->createQuery(); diff --git a/Classes/Persistence/Storage/VidiDbBackend.php b/Classes/Persistence/Storage/VidiDbBackend.php index 945e0d1..3d36a87 100644 --- a/Classes/Persistence/Storage/VidiDbBackend.php +++ b/Classes/Persistence/Storage/VidiDbBackend.php @@ -319,7 +319,7 @@ protected function parseSource(SourceInterface $source, array &$sql) * @param array &$parameters The parameters that will replace the markers * @return void */ - protected function parseConstraint(ConstraintInterface $constraint = null, SourceInterface $source, array &$statementParts, array &$parameters) + protected function parseConstraint(?ConstraintInterface $constraint, SourceInterface $source, array &$statementParts, array &$parameters) { if ($constraint instanceof AndInterface) { $statementParts['where'][] = '('; diff --git a/Classes/Service/ContentService.php b/Classes/Service/ContentService.php index d85a1a5..00298ed 100644 --- a/Classes/Service/ContentService.php +++ b/Classes/Service/ContentService.php @@ -58,7 +58,7 @@ public function __construct($dataType = '') * @param int $offset * @return $this */ - public function findBy(Matcher $matcher, Order $order = null, $limit = null, $offset = null) + public function findBy(Matcher $matcher, ?Order $order = null, $limit = null, $offset = null) { // Query the repository. $objects = ContentRepositoryFactory::getInstance($this->dataType)->findBy($matcher, $order, $limit, $offset); @@ -87,7 +87,7 @@ public function findBy(Matcher $matcher, Order $order = null, $limit = null, $of * @param int $offset * @return AfterFindContentObjectsSignalArguments */ - protected function emitAfterFindContentObjectsSignal($contentObjects, Matcher $matcher, Order $order = null, $limit = 0, $offset = 0) + protected function emitAfterFindContentObjectsSignal($contentObjects, Matcher $matcher, ?Order $order = null, $limit = 0, $offset = 0) { /** @var AfterFindContentObjectsSignalArguments $signalArguments */ $signalArguments = GeneralUtility::makeInstance(AfterFindContentObjectsSignalArguments::class); diff --git a/Classes/TypeConverter/CsvToArrayConverter.php b/Classes/TypeConverter/CsvToArrayConverter.php index 9108640..e702be1 100644 --- a/Classes/TypeConverter/CsvToArrayConverter.php +++ b/Classes/TypeConverter/CsvToArrayConverter.php @@ -45,7 +45,7 @@ class CsvToArrayConverter extends AbstractTypeConverter * @throws FileDoesNotExistException * @api */ - public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) + public function convertFrom($source, $targetType, array $convertedChildProperties = [], ?PropertyMappingConfigurationInterface $configuration = null) { return GeneralUtility::trimExplode(',', $source, true); } diff --git a/Classes/View/Button/DeleteButton.php b/Classes/View/Button/DeleteButton.php index 5f3795d..f9b2ec3 100644 --- a/Classes/View/Button/DeleteButton.php +++ b/Classes/View/Button/DeleteButton.php @@ -25,7 +25,7 @@ class DeleteButton extends AbstractComponentView * @param Content $object * @return string */ - public function render(Content $object = null) + public function render(?Content $object = null) { $labelField = Tca::table($object->getDataType())->getLabelField(); $label = $object[$labelField] ? $object[$labelField] : $object->getUid(); diff --git a/Classes/View/Button/EditButton.php b/Classes/View/Button/EditButton.php index 89863a1..9f8652a 100644 --- a/Classes/View/Button/EditButton.php +++ b/Classes/View/Button/EditButton.php @@ -26,7 +26,7 @@ class EditButton extends AbstractComponentView * @param Content $object * @return string */ - public function render(Content $object = null) + public function render(?Content $object = null) { $editUri = $this->getUriRenderer()->render($object); diff --git a/Classes/View/Grid/Row.php b/Classes/View/Grid/Row.php index 90285d1..d1c216f 100644 --- a/Classes/View/Grid/Row.php +++ b/Classes/View/Grid/Row.php @@ -54,7 +54,7 @@ public function __construct(array $columns = []) * @return array * @throws \Exception */ - public function render(Content $object = null, $rowIndex = 0) + public function render(?Content $object = null, $rowIndex = 0) { // Initialize returned array $output = []; diff --git a/Classes/View/System/ButtonsSystem.php b/Classes/View/System/ButtonsSystem.php index d990797..b3cc5f9 100644 --- a/Classes/View/System/ButtonsSystem.php +++ b/Classes/View/System/ButtonsSystem.php @@ -24,7 +24,7 @@ class ButtonsSystem extends AbstractComponentView * @param Content $object * @return string */ - public function render(Content $object = null) + public function render(?Content $object = null) { return ''; } diff --git a/Classes/View/System/CheckboxSystem.php b/Classes/View/System/CheckboxSystem.php index ce31eb6..17c0b9a 100644 --- a/Classes/View/System/CheckboxSystem.php +++ b/Classes/View/System/CheckboxSystem.php @@ -25,7 +25,7 @@ class CheckboxSystem extends AbstractComponentView * @param int $offset * @return string */ - public function render(Content $object = null, $offset = 0) + public function render(?Content $object = null, $offset = 0) { return ''; } diff --git a/Classes/View/Uri/EditUri.php b/Classes/View/Uri/EditUri.php index a2633d8..7142503 100644 --- a/Classes/View/Uri/EditUri.php +++ b/Classes/View/Uri/EditUri.php @@ -24,7 +24,7 @@ class EditUri extends AbstractComponentView * @param Content $object * @return string */ - public function render(Content $object = null) + public function render(?Content $object = null) { $uri = BackendUtility::getModuleUrl( 'record_edit', From 20a643b5a02333705220c2221f3fb6903e97a843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hyacinthe=20Compaor=C3=A9?= <131278191+compaoreh338@users.noreply.github.com> Date: Wed, 28 Jan 2026 14:21:05 +0000 Subject: [PATCH 10/11] Update TYPO3 CMS core version requirement --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d7e6bd9..60d24ec 100644 --- a/composer.json +++ b/composer.json @@ -28,6 +28,6 @@ }, "require": { "php": ">=8.0", - "typo3/cms-core": "^13" + "typo3/cms-core": "^12 || ^13" } } From 20db5589fb676eab6bf024ca075c47432831fafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hyacinthe=20Compaor=C3=A9?= <131278191+compaoreh338@users.noreply.github.com> Date: Mon, 9 Mar 2026 15:29:30 +0000 Subject: [PATCH 11/11] FIX: Update Query.php --- Classes/Persistence/Query.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Classes/Persistence/Query.php b/Classes/Persistence/Query.php index 5745341..83d557a 100644 --- a/Classes/Persistence/Query.php +++ b/Classes/Persistence/Query.php @@ -28,6 +28,8 @@ use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException; use Fab\Vidi\Persistence\Storage\VidiDbBackend; use TYPO3\CMS\Core\Http\ApplicationType; +use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidNumberOfConstraintsException; use TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnexpectedTypeException; @@ -254,7 +256,12 @@ public function getSource(): SourceInterface public function execute($returnRawQueryResult = false): QueryResultInterface|array { /** @var VidiDbBackend $backend */ - $backend = GeneralUtility::makeInstance(VidiDbBackend::class, $this); + $backend = GeneralUtility::makeInstance( + VidiDbBackend::class, + $this, + GeneralUtility::makeInstance(Context::class), + GeneralUtility::makeInstance(ConnectionPool::class) + ); return $backend->fetchResult(); } @@ -657,4 +664,4 @@ public function getQuerySettings(): QuerySettingsInterface { return $this->typo3QuerySettings; } -} \ No newline at end of file +}