From 6a8155bac36aba7b043c10c669b44c7e31c57f21 Mon Sep 17 00:00:00 2001 From: Aleksey Tupichenkov Date: Fri, 29 Aug 2025 14:49:02 +0300 Subject: [PATCH 1/2] feat: update schema context bundle --- README.md | 8 ++++---- composer.json | 2 +- src/Doctrine/SchemaConnection.php | 6 +++--- tests/Doctrine/SchemaConnectionTest.php | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6f211ea..fe402b7 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Enable the bundle by adding it to the list of registered bundles in ```config/bu return [ // ... Macpaw\SchemaContextBundle\SchemaContextBundle::class => ['all' => true], - Macpaw\SchemaContextBundle\PostgresSchemaBundle::class => ['all' => true], + \Macpaw\PostgresSchemaBundle\PostgresSchemaBundle::class => ['all' => true], ]; ``` @@ -42,12 +42,12 @@ doctrine: wrapper_class: Macpaw\PostgresSchemaBundle\Doctrine\SchemaConnection ``` -Set `SchemaResolver` to `SchemaConnection` at kernel boot +Set `BaggageSchemaResolver` to `SchemaConnection` at kernel boot ```php # src/Kernel.php use Macpaw\PostgresSchemaBundle\Doctrine\SchemaConnection; -use Macpaw\SchemaContextBundle\Service\SchemaResolver; +use Macpaw\SchemaContextBundle\Service\BaggageSchemaResolver; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\HttpKernel\Kernel as BaseKernel; @@ -60,7 +60,7 @@ class Kernel extends BaseKernel parent::boot(); SchemaConnection::setSchemaResolver( - $this->getContainer()->get(SchemaResolver::class), + $this->getContainer()->get(BaggageSchemaResolver::class), ); } diff --git a/composer.json b/composer.json index 68e4f78..5768661 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "doctrine/orm": "^2.17 || ^3.0", "symfony/doctrine-bridge": "^6.4 || ^7.0", "doctrine/dbal": "^3.4", - "macpaw/schema-context-bundle": "^1.0" + "macpaw/schema-context-bundle": "^1.1" }, "require-dev": { "phpstan/phpstan": "^1.10", diff --git a/src/Doctrine/SchemaConnection.php b/src/Doctrine/SchemaConnection.php index e7982ac..3061389 100644 --- a/src/Doctrine/SchemaConnection.php +++ b/src/Doctrine/SchemaConnection.php @@ -7,13 +7,13 @@ use Doctrine\DBAL\Connection as DBALConnection; use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Macpaw\PostgresSchemaBundle\Exception\UnsupportedPlatformException; -use Macpaw\SchemaContextBundle\Service\SchemaResolver; +use Macpaw\SchemaContextBundle\Service\BaggageSchemaResolver; class SchemaConnection extends DBALConnection { - private static ?SchemaResolver $schemaResolver = null; + private static ?BaggageSchemaResolver $schemaResolver = null; - public static function setSchemaResolver(SchemaResolver $resolver): void + public static function setSchemaResolver(BaggageSchemaResolver $resolver): void { self::$schemaResolver = $resolver; } diff --git a/tests/Doctrine/SchemaConnectionTest.php b/tests/Doctrine/SchemaConnectionTest.php index 993655e..0caa41a 100644 --- a/tests/Doctrine/SchemaConnectionTest.php +++ b/tests/Doctrine/SchemaConnectionTest.php @@ -13,7 +13,7 @@ use Doctrine\DBAL\Platforms\MySQLPlatform; use Macpaw\PostgresSchemaBundle\Doctrine\SchemaConnection; use Macpaw\PostgresSchemaBundle\Exception\UnsupportedPlatformException; -use Macpaw\SchemaContextBundle\Service\SchemaResolver; +use Macpaw\SchemaContextBundle\Service\BaggageSchemaResolver; use PHPUnit\Framework\TestCase; class SchemaConnectionTest extends TestCase @@ -39,7 +39,7 @@ public function testConnectSetsSearchPath(): void $connection->method('getDatabasePlatform')->willReturn($platform); $connection->method('fetchOne')->willReturn(true); - $resolver = new SchemaResolver(); + $resolver = new BaggageSchemaResolver(); $resolver->setSchema('test_schema'); @@ -59,7 +59,7 @@ public function testConnectSkipsWhenNoSchema(): void $driver->method('connect')->willReturn($driverConnection); $connection = new SchemaConnection([], $driver, new Configuration()); - $resolver = new SchemaResolver(); + $resolver = new BaggageSchemaResolver(); SchemaConnection::setSchemaResolver($resolver); @@ -83,7 +83,7 @@ public function testThrowsForUnsupportedPlatform(): void $connection->method('getDatabasePlatform')->willReturn($platform); - $resolver = new SchemaResolver(); + $resolver = new BaggageSchemaResolver(); $resolver->setSchema('test_schema'); From 33cac9b05a1613c5ff7b8778795170526003ba98 Mon Sep 17 00:00:00 2001 From: Aleksey Tupichenkov Date: Fri, 29 Aug 2025 14:50:07 +0300 Subject: [PATCH 2/2] chore: fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fe402b7..baedcc0 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Enable the bundle by adding it to the list of registered bundles in ```config/bu return [ // ... Macpaw\SchemaContextBundle\SchemaContextBundle::class => ['all' => true], - \Macpaw\PostgresSchemaBundle\PostgresSchemaBundle::class => ['all' => true], + Macpaw\PostgresSchemaBundle\PostgresSchemaBundle::class => ['all' => true], ]; ```