From e7daa33d6eade183e3f9809d359438e6cbcde4b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Niklas?= Date: Tue, 29 Oct 2024 10:59:04 +0100 Subject: [PATCH] [BUGFIX] Extension list view throws errors (#236) * [BUGFIX] Add missing action in form * [BUGFIX] Add closing div tag * [TASK] Add margin bottom class * [BUGFIX] Change QueryBuilder in ExtensionRepository --- .../Domain/Repository/ExtensionRepository.php | 24 +++++++++++++++---- .../Private/Templates/Extension/List.html | 4 +++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Classes/Domain/Repository/ExtensionRepository.php b/Classes/Domain/Repository/ExtensionRepository.php index 6f607c8..51057cd 100644 --- a/Classes/Domain/Repository/ExtensionRepository.php +++ b/Classes/Domain/Repository/ExtensionRepository.php @@ -11,6 +11,7 @@ * LICENSE.txt file that was distributed with this source code. */ +use Doctrine\DBAL\Exception; use T3Monitor\T3monitoring\Domain\Model\Dto\ExtensionFilterDemand; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; @@ -25,6 +26,10 @@ public function initializeObject(): void $this->setDefaultOrderings(['name' => QueryInterface::ORDER_ASCENDING]); } + /** + * @param string $name + * @return QueryResultInterface|array + */ public function findAllVersionsByName(string $name): QueryResultInterface|array { $query = $this->getQuery(); @@ -36,6 +41,11 @@ public function findAllVersionsByName(string $name): QueryResultInterface|array return $query->execute(); } + /** + * @param ExtensionFilterDemand $demand + * @return array + * @throws Exception + */ public function findByDemand(ExtensionFilterDemand $demand): array { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_t3monitoring_domain_model_extension'); @@ -52,9 +62,9 @@ public function findByDemand(ExtensionFilterDemand $demand): array ->orderBy('ext.version_integer', 'DESC') ->orderBy('client.title', 'ASC'); $this->extendWhereClause($demand, $queryBuilder); - + $statement = $queryBuilder->executeQuery(); $result = []; - while ($row = $queryBuilder->executeQuery()->fetchAssociative()) { + while ($row = $statement->fetchAssociative()) { $result[$row['name']][$row['version']]['insecure'] = $row['insecure']; $result[$row['name']][$row['version']]['clients'][] = $row; } @@ -62,6 +72,10 @@ public function findByDemand(ExtensionFilterDemand $demand): array return $result; } + /** + * @param ExtensionFilterDemand $demand + * @param QueryBuilder $qb + */ protected function extendWhereClause(ExtensionFilterDemand $demand, QueryBuilder $qb): void { if (!$demand->getName()) { @@ -70,8 +84,10 @@ protected function extendWhereClause(ExtensionFilterDemand $demand, QueryBuilder if ($demand->isExactSearch()) { $condition = $qb->expr()->eq('ext.name', $qb->createNamedParameter($demand->getName())); } else { - $condition = $qb->expr()->like('ext.name', - $qb->createNamedParameter('%' . $qb->escapeLikeWildcards($demand->getName()) . '%')); + $condition = $qb->expr()->like( + 'ext.name', + $qb->createNamedParameter('%' . $qb->escapeLikeWildcards($demand->getName()) . '%') + ); } $qb->andWhere($condition); } diff --git a/Resources/Private/Templates/Extension/List.html b/Resources/Private/Templates/Extension/List.html index 75e4982..343e838 100644 --- a/Resources/Private/Templates/Extension/List.html +++ b/Resources/Private/Templates/Extension/List.html @@ -7,7 +7,7 @@

{f:translate(key:'view.usedExtensions')}

- +
@@ -72,6 +72,7 @@

{f:translate(key:'view.usedExtensions')}

+
@@ -80,4 +81,5 @@

{f:translate(key:'view.usedExtensions')}

+