From 58767e1a2651c280289f211316e3d7ea22c54e7f Mon Sep 17 00:00:00 2001 From: Quentin Robinet <7536178+Qt1Rbt@users.noreply.github.com> Date: Wed, 24 Sep 2025 10:27:58 +0200 Subject: [PATCH 1/3] chore: allow installation with doctrine/persistence 4.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5b6d7c4..03eb81f 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "php": ">= 8.2", "algolia/algoliasearch-client-php": "^3.0", "doctrine/event-manager": "^1.1 || ^2.0", - "doctrine/persistence": "^2.1 || ^3.0", + "doctrine/persistence": "^2.1 || ^3.0 || ^4.0", "symfony/filesystem": "^7.0", "symfony/property-access": "^7.0", "symfony/serializer": "^7.0" From 113ea716b3fd5dcb101e82c72c71ee04b1c48252 Mon Sep 17 00:00:00 2001 From: Quentin Robinet <7536178+Qt1Rbt@users.noreply.github.com> Date: Wed, 24 Sep 2025 12:26:56 +0200 Subject: [PATCH 2/3] chore: allow doctrine/orm ^3.0 to allow doctrine/persistence ^4.0 installation --- composer.json | 2 +- tests/TestCase/CommandsTest.php | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 03eb81f..cfd8240 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "require-dev": { "ext-json": "*", "doctrine/doctrine-bundle": "^2.12", - "doctrine/orm": "^2.5", + "doctrine/orm": "^2.5 || ^3.0", "friendsofphp/php-cs-fixer": "^v3.54.0", "jms/serializer-bundle": "^5.4.0", "friendsofphp/proxy-manager-lts": "*", diff --git a/tests/TestCase/CommandsTest.php b/tests/TestCase/CommandsTest.php index 44d27c2..dbce812 100644 --- a/tests/TestCase/CommandsTest.php +++ b/tests/TestCase/CommandsTest.php @@ -86,6 +86,17 @@ public function testSearchClear(): void $this->cleanUp(); } + private function polyfillExecuteStatement(string $statement, array $params = []): void + { + if (method_exists($this->connection, 'executeStatement')) { + //doctrine/orm ^3.0 + $this->connection->executeStatement($statement, $params); + } else { + //doctrine/orm ^2.5 + $this->connection->executeUpdate($statement, $params); + } + } + public function testSearchImportAggregator(): void { for ($i = 1; $i <= 2; $i++) { @@ -120,7 +131,7 @@ public function testSearchImportAggregator(): void $searchPost = $this->searchService->rawSearch(ContentAggregator::class); self::assertCount($expectedResult, $searchPost['hits']); // clearup table - $this->connection->executeUpdate($this->platform->getTruncateTableSQL($this->indexName, true)); + $this->polyfillExecuteStatement($this->platform->getTruncateTableSQL($this->indexName, true)); $this->cleanUp(); } @@ -169,7 +180,7 @@ public function testSearchImport($isAtomic): void self::assertCount($expectedResult, $searchPost['hits']); // clearup table - $this->connection->executeUpdate($this->platform->getTruncateTableSQL($this->indexName, true)); + $this->polyfillExecuteStatement($this->platform->getTruncateTableSQL($this->indexName, true)); $this->cleanUp(); } From 24363b593437e5cc77e27700867eea0e834882de Mon Sep 17 00:00:00 2001 From: Quentin Robinet <7536178+Qt1Rbt@users.noreply.github.com> Date: Wed, 24 Sep 2025 12:32:24 +0200 Subject: [PATCH 3/3] chore: fixing coding styles error --- src/Command/SearchImportCommand.php | 2 +- tests/TestCase/CommandsTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Command/SearchImportCommand.php b/src/Command/SearchImportCommand.php index 3b9bcb4..7930170 100644 --- a/src/Command/SearchImportCommand.php +++ b/src/Command/SearchImportCommand.php @@ -37,7 +37,7 @@ public function __construct( SearchService $searchService, SearchService $searchServiceForAtomicReindex, ManagerRegistry $managerRegistry, - SearchClient $searchClient + SearchClient $searchClient, ) { parent::__construct($searchService); diff --git a/tests/TestCase/CommandsTest.php b/tests/TestCase/CommandsTest.php index dbce812..8a2ee11 100644 --- a/tests/TestCase/CommandsTest.php +++ b/tests/TestCase/CommandsTest.php @@ -89,10 +89,10 @@ public function testSearchClear(): void private function polyfillExecuteStatement(string $statement, array $params = []): void { if (method_exists($this->connection, 'executeStatement')) { - //doctrine/orm ^3.0 + // doctrine/orm ^3.0 $this->connection->executeStatement($statement, $params); } else { - //doctrine/orm ^2.5 + // doctrine/orm ^2.5 $this->connection->executeUpdate($statement, $params); } }