From 99ea023a8daa1c1aed22047492546b42506ff3c9 Mon Sep 17 00:00:00 2001 From: Dawid Parafinski Date: Wed, 19 Aug 2026 08:37:43 +0200 Subject: [PATCH] IBX-12043: Upgraded to Doctrine DBAL 4 DatabasePlatformResolver moved to ibexa/doctrine-schema, so the System Info page died with "Class Ibexa\Core\Persistence\Doctrine\DatabasePlatformResolver not found" while rendering. The resolver also returns null for an unrecognised platform rather than throwing, so the catch it was wrapped in could never fire. doctrine-schema becomes a direct requirement, since production code now imports from it rather than relying on it arriving through ibexa/core. Join conditions and ExpressionBuilder are string-only in DBAL 4. One join condition was suppressed in the PHPStan baseline rather than fixed, which hid a TypeError that only shows up when the metric runs; that entry is gone. --- composer.json | 2 +- phpstan-baseline.neon | 7 ------- .../Collector/RepositorySystemInfoCollector.php | 10 +++------- src/lib/Storage/Metrics/ContentTypesCountMetrics.php | 2 +- src/lib/Storage/Metrics/DraftsCountMetrics.php | 4 ++-- .../Metrics/PublishedContentObjectsCountMetrics.php | 2 +- 6 files changed, 8 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index 03e7e78..c85c4f6 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "ext-json": "*", "ibexa/admin-ui": "~6.0.x-dev", "ibexa/core": "~6.0.x-dev", + "ibexa/doctrine-schema": "~6.0.x-dev", "ibexa/twig-components": "~6.0.x-dev", "zetacomponents/system-information": "^1.1.1" }, @@ -20,7 +21,6 @@ "ibexa/content-forms": "~6.0.x-dev", "ibexa/design-engine": "~6.0.x-dev", "ibexa/design-system-twig": "~6.0.x-dev", - "ibexa/doctrine-schema": "~6.0.x-dev", "ibexa/fieldtype-richtext": "~6.0.x-dev", "ibexa/http-cache": "~6.0.x-dev", "ibexa/notifications": "~6.0.x-dev", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a984055..e69de29 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,7 +0,0 @@ -parameters: - ignoreErrors: - - - message: '#^Parameter \#4 \$condition of method Doctrine\\DBAL\\Query\\QueryBuilder\:\:innerJoin\(\) expects string\|null, Doctrine\\DBAL\\Query\\Expression\\CompositeExpression given\.$#' - identifier: argument.type - count: 1 - path: src/lib/Storage/Metrics/DraftsCountMetrics.php diff --git a/src/bundle/SystemInfo/Collector/RepositorySystemInfoCollector.php b/src/bundle/SystemInfo/Collector/RepositorySystemInfoCollector.php index 582a977..55e0031 100644 --- a/src/bundle/SystemInfo/Collector/RepositorySystemInfoCollector.php +++ b/src/bundle/SystemInfo/Collector/RepositorySystemInfoCollector.php @@ -11,8 +11,7 @@ use Doctrine\DBAL\Connection; use Ibexa\Bundle\SystemInfo\SystemInfo\Value\RepositoryMetrics; use Ibexa\Bundle\SystemInfo\SystemInfo\Value\RepositorySystemInfo; -use Ibexa\Core\Base\Exceptions\InvalidArgumentException; -use Ibexa\Core\Persistence\Doctrine\DatabasePlatformResolver; +use Ibexa\Contracts\DoctrineSchema\Database\DatabasePlatformResolver; use Ibexa\SystemInfo\Storage\MetricsProvider; /** @@ -51,11 +50,8 @@ private function getDatabasePlatformName(): string { $platform = $this->connection->getDatabasePlatform(); - try { - return DatabasePlatformResolver::resolveName($platform)->value; - } catch (InvalidArgumentException) { - return $platform::class; - } + // The resolver returns null for a platform it does not recognise rather than throwing. + return DatabasePlatformResolver::resolveName($platform)->value ?? $platform::class; } private function populateRepositoryMetricsData(): RepositoryMetrics diff --git a/src/lib/Storage/Metrics/ContentTypesCountMetrics.php b/src/lib/Storage/Metrics/ContentTypesCountMetrics.php index 6e7cc00..bfb57f9 100644 --- a/src/lib/Storage/Metrics/ContentTypesCountMetrics.php +++ b/src/lib/Storage/Metrics/ContentTypesCountMetrics.php @@ -29,7 +29,7 @@ public function getValue(): int ->select($this->getCountExpression(self::ID_COLUMN)) ->from(ContentTypeGateway::CONTENT_TYPE_TABLE) ->where( - $queryBuilder->expr()->eq(self::STATUS_COLUMN, Type::STATUS_DEFINED) + $queryBuilder->expr()->eq(self::STATUS_COLUMN, (string)Type::STATUS_DEFINED) ); return (int)$queryBuilder->executeQuery()->fetchOne(); diff --git a/src/lib/Storage/Metrics/DraftsCountMetrics.php b/src/lib/Storage/Metrics/DraftsCountMetrics.php index 3ddecc0..8855042 100644 --- a/src/lib/Storage/Metrics/DraftsCountMetrics.php +++ b/src/lib/Storage/Metrics/DraftsCountMetrics.php @@ -32,9 +32,9 @@ public function getValue(): int 'v', ContentGateway::CONTENT_ITEM_TABLE, 'c', - $expr->and( + (string)$expr->and( $expr->eq('c.id', 'v.contentobject_id'), - $expr->neq('c.status', ContentInfo::STATUS_TRASHED) + $expr->neq('c.status', (string)ContentInfo::STATUS_TRASHED) ) ) ->where( diff --git a/src/lib/Storage/Metrics/PublishedContentObjectsCountMetrics.php b/src/lib/Storage/Metrics/PublishedContentObjectsCountMetrics.php index f01793a..9031e2d 100644 --- a/src/lib/Storage/Metrics/PublishedContentObjectsCountMetrics.php +++ b/src/lib/Storage/Metrics/PublishedContentObjectsCountMetrics.php @@ -29,7 +29,7 @@ public function getValue(): int ->select($this->getCountExpression(self::ID_COLUMN)) ->from(ContentGateway::CONTENT_ITEM_TABLE) ->where( - $queryBuilder->expr()->eq(self::STATUS_COLUMN, ContentInfo::STATUS_PUBLISHED) + $queryBuilder->expr()->eq(self::STATUS_COLUMN, (string)ContentInfo::STATUS_PUBLISHED) ); return (int)$queryBuilder->executeQuery()->fetchOne();