Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/backend-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
- name: Run integration test suite vs Postgresql
run: composer run-script integration
env:
DATABASE_URL: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb?server_version=10"
DATABASE_URL: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb?serverVersion=${{ matrix.image == 'postgres:18' && '18' || '14' }}"
# Required by old repository tests
DATABASE: "pgsql://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/testdb"

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"ext-xsl": "*",
"composer/package-versions-deprecated": "^1.11",
"doctrine/annotations": "^2.0",
"doctrine/dbal": "^3.8.2",
"doctrine/dbal": "^4.4.4",
"doctrine/doctrine-bundle": "^2.19",
"doctrine/orm": "^3.3",
"doctrine/persistence": "^3.3.1",
"friendsofphp/proxy-manager-lts": "^1.0",
"friendsofsymfony/http-cache-bundle": "^3.0",
"friendsofsymfony/jsrouting-bundle": "^3.5",
"ibexa/doctrine-schema": "~6.0.x-dev",
"ibexa/doctrine-schema": "dev-dbal-4-upgrade as 6.0.x-dev",
"ibexa/jms-translation-bundle": "^2.6.0",
"league/flysystem-memory": "^2.0.6",
"liip/imagine-bundle": "^2.3",
Expand Down
20 changes: 0 additions & 20 deletions phpstan-baseline-lte-8.3.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,13 @@ parameters:
count: 1
path: src/bundle/Core/Features/Context/UserContext.php

-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 1
path: src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 1
path: src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 1
path: src/lib/Persistence/Legacy/URL/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
Expand All @@ -42,23 +32,13 @@ parameters:
count: 1
path: src/lib/Repository/UserPreferenceService.php

-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 1
path: src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 1
path: src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 1
path: src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
Expand Down
86 changes: 1 addition & 85 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,6 @@ parameters:
count: 1
path: src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php

-
message: '#^Parameter \#2 \$value of method Doctrine\\DBAL\\Query\\QueryBuilder\:\:set\(\) expects string, int given\.$#'
identifier: argument.type
count: 2
path: src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php

-
message: '#^Property Ibexa\\Bundle\\Core\\Command\\UpdateTimestampsToUTCCommand\:\:\$from \(string\) does not accept int\.$#'
identifier: assign.propertyType
Expand Down Expand Up @@ -6264,12 +6258,6 @@ parameters:
count: 1
path: src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php

-
message: '#^Parameter \#1 \$select of method Doctrine\\DBAL\\Query\\QueryBuilder\:\:select\(\) expects array\<string\>\|string\|null, int given\.$#'
identifier: argument.type
count: 2
path: src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php

-
message: '#^Parameter \#3 \$pad_string of function str_pad expects string, int given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -11790,12 +11778,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php

-
message: '#^Parameter \#2 \$value2 of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:getBitAndComparisonExpression\(\) expects string, int given\.$#'
identifier: argument.type
count: 2
path: src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Persistence\\Content\\MetadataUpdateStruct\:\:\$alwaysAvailable \(bool\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -11823,7 +11805,7 @@ parameters:
-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 14
count: 1
path: src/lib/Persistence/Legacy/Content/Gateway/ExceptionConversion.php

-
Expand Down Expand Up @@ -12324,24 +12306,12 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php

-
message: '#^Parameter \#2 \$value2 of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:getBitAndComparisonExpression\(\) expects string, int given\.$#'
identifier: argument.type
count: 1
path: src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php

-
message: '#^Parameter \#2 \$y of method Doctrine\\DBAL\\Query\\Expression\\ExpressionBuilder\:\:in\(\) expects array\<string\>\|string, list\<int\> given\.$#'
identifier: argument.type
count: 1
path: src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php

-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 8
path: src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
identifier: catch.neverThrown
Expand Down Expand Up @@ -12708,12 +12678,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabase.php

-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 4
path: src/lib/Persistence/Legacy/Content/ObjectState/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
identifier: catch.neverThrown
Expand Down Expand Up @@ -13140,12 +13104,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php

-
message: '#^Parameter \#4 \$condition of method Doctrine\\DBAL\\Query\\QueryBuilder\:\:leftJoin\(\) expects string\|null, Doctrine\\DBAL\\Query\\Expression\\CompositeExpression given\.$#'
identifier: argument.type
count: 5
path: src/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\Group\:\:\$isSystem \(bool\) on left side of \?\? is not nullable\.$#'
identifier: nullCoalesce.property
Expand All @@ -13158,12 +13116,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php

-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 4
path: src/lib/Persistence/Legacy/Content/Type/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
identifier: catch.neverThrown
Expand Down Expand Up @@ -13752,12 +13704,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php

-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 2
path: src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
identifier: catch.neverThrown
Expand Down Expand Up @@ -14124,12 +14070,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabase.php

-
message: '#^Dead catch \- Doctrine\\DBAL\\Exception is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 1
path: src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/ExceptionConversion.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
identifier: catch.neverThrown
Expand Down Expand Up @@ -14844,12 +14784,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Setting/Gateway/DoctrineDatabase.php

-
message: '#^Dead catch \- PDOException is never thrown in the try block\.$#'
identifier: catch.neverThrown
count: 5
path: src/lib/Persistence/Legacy/Setting/Gateway/ExceptionConversion.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Setting\\Gateway\\ExceptionConversion\:\:loadSetting\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -15090,12 +15024,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/URL/Query/CriteriaConverter.php

-
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/Persistence/Legacy/URL/Query/CriterionHandler/Base.php

-
message: '#^Access to an undefined property Ibexa\\Contracts\\Core\\Repository\\Values\\URL\\Query\\Criterion\:\:\$criteria\.$#'
identifier: property.notFound
Expand Down Expand Up @@ -19104,12 +19032,6 @@ parameters:
count: 1
path: src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php

-
message: '#^Parameter \#1 \$firstResult of method Doctrine\\DBAL\\Query\\QueryBuilder\:\:setFirstResult\(\) expects int, int\|null given\.$#'
identifier: argument.type
count: 1
path: src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php

-
message: '#^Method Ibexa\\Core\\Search\\Legacy\\Content\\Gateway\\ExceptionConversion\:\:find\(\) has parameter \$languageFilter with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -51972,12 +51894,6 @@ parameters:
count: 1
path: tests/lib/Persistence/Legacy/SharedGateway/GatewayFactoryTest.php

-
message: '#^PHPDoc tag @var with type Doctrine\\DBAL\\Platforms\\AbstractPlatform is not subtype of native type Doctrine\\DBAL\\Platforms\\MySQL80Platform\|Doctrine\\DBAL\\Platforms\\MySQLPlatform\|Doctrine\\DBAL\\Platforms\\PostgreSQLPlatform\|Doctrine\\DBAL\\Platforms\\SqlitePlatform\.$#'
identifier: varTag.nativeType
count: 1
path: tests/lib/Persistence/Legacy/SharedGateway/GatewayFactoryTest.php

-
message: '#^Parameter \#1 \$expected of static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) expects class\-string\<object\>, string given\.$#'
identifier: argument.type
Expand Down
10 changes: 5 additions & 5 deletions src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,11 @@ protected function updateTimestampToUTC(
) {
$query = $this->connection->createQueryBuilder();
$query
->update(Gateway::CONTENT_FIELD_TABLE, 'a')
->set('a.data_int', $newTimestamp)
->set('a.sort_key_int', $newTimestamp)
->where('a.id = :id')
->andWhere('a.version = :version')
->update(Gateway::CONTENT_FIELD_TABLE)
->set('data_int', (string)$newTimestamp)
->set('sort_key_int', (string)$newTimestamp)
->where('id = :id')
->andWhere('version = :version')
->setParameter('id', $contentAttributeId)
->setParameter('version', $contentAttributeVersion);

Expand Down
3 changes: 3 additions & 0 deletions src/bundle/Core/Doctrine/ManagedTablesSchemaAssetFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}

/**
* @param string|\Doctrine\DBAL\Schema\AbstractAsset<covariant \Doctrine\DBAL\Schema\Name> $asset
*/
public function __invoke(string|AbstractAsset $asset): bool
{
$tableName = $asset instanceof AbstractAsset ? $asset->getName() : $asset;
Expand Down
19 changes: 16 additions & 3 deletions src/bundle/RepositoryInstaller/Installer/CoreInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
use Ibexa\Contracts\DoctrineSchema\Builder\SchemaBuilderInterface;
use Ibexa\Contracts\DoctrineSchema\DbPlatformFactoryInterface;
use Ibexa\Contracts\DoctrineSchema\SchemaAssetsFilterBypassInterface;
use Symfony\Component\Console\Helper\ProgressBar;

Expand All @@ -26,19 +27,31 @@ class CoreInstaller extends DbBasedInstaller implements Installer

private SchemaAssetsFilterBypassInterface $schemaAssetsFilterBypass;

private DbPlatformFactoryInterface $dbPlatformFactory;

/**
* @param \Doctrine\DBAL\Connection $db
* @param \Ibexa\Contracts\DoctrineSchema\Builder\SchemaBuilderInterface $schemaBuilder
*/
public function __construct(
Connection $db,
SchemaBuilderInterface $schemaBuilder,
SchemaAssetsFilterBypassInterface $schemaAssetsFilterBypass
SchemaAssetsFilterBypassInterface $schemaAssetsFilterBypass,
DbPlatformFactoryInterface $dbPlatformFactory
) {
parent::__construct($db);

$this->schemaBuilder = $schemaBuilder;
$this->schemaAssetsFilterBypass = $schemaAssetsFilterBypass;
$this->dbPlatformFactory = $dbPlatformFactory;
}

private function getIbexaDatabasePlatform(): AbstractPlatform
{
$driverName = $this->db->getParams()['driver'] ?? '';

return $this->dbPlatformFactory->createDatabasePlatformFromDriverName($driverName)
?? $this->db->getDatabasePlatform();
}

/**
Expand All @@ -55,7 +68,7 @@ public function importSchema()
{
// note: schema is built using Schema Builder event-driven API
$schema = $this->schemaBuilder->buildSchema();
$databasePlatform = $this->db->getDatabasePlatform();
$databasePlatform = $this->getIbexaDatabasePlatform();
$queries = array_merge(
$this->getDropSqlStatementsForExistingSchema($schema, $databasePlatform),
// generate schema DDL queries
Expand Down Expand Up @@ -125,7 +138,7 @@ protected function getDropSqlStatementsForExistingSchema(
// cleanup pre-existing database
foreach ($tables as $table) {
if (in_array($table->getName(), $existingTableNames, true)) {
$statements[] = $databasePlatform->getDropTableSQL($table);
$statements[] = $databasePlatform->getDropTableSQL($table->getName());
}
}

Expand Down
13 changes: 11 additions & 2 deletions src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
namespace Ibexa\Bundle\RepositoryInstaller\Installer;

use Doctrine\DBAL\Connection;
use Ibexa\Contracts\DoctrineSchema\Database\DatabasePlatformResolver;
use Ibexa\Core\Base\Exceptions\InvalidArgumentException;
use Ibexa\Core\Persistence\Doctrine\DatabasePlatformResolver;
use Symfony\Component\Filesystem\Filesystem;

class DbBasedInstaller
Expand Down Expand Up @@ -108,6 +108,15 @@ final protected function getKernelSQLFileForDBMS($relativeFilePath)

protected function getDBMSDataDirectoryName(): string
{
return DatabasePlatformResolver::resolveName($this->db->getDatabasePlatform())->value;
$platform = $this->db->getDatabasePlatform();
$name = DatabasePlatformResolver::resolveName($platform);
if ($name === null) {
throw new InvalidArgumentException(
'platform',
sprintf('Unsupported database platform: %s', $platform::class)
);
}

return $name->value;
}
}
Loading
Loading