From 078d7a3aaccb05e4f173f5e88fbcfc38124e2af6 Mon Sep 17 00:00:00 2001 From: Aleksey Tupichenkov Date: Thu, 28 Aug 2025 09:29:10 +0300 Subject: [PATCH 1/4] chore: update readme --- README.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 502c9da..6f211ea 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ Enable the bundle by adding it to the list of registered bundles in ```config/bu ['all' => true], - Macpaw\SchemaContextBundle\PostgresSchemaBundle::class => ['all' => true], - // ... - ]; + // ... + Macpaw\SchemaContextBundle\SchemaContextBundle::class => ['all' => true], + Macpaw\SchemaContextBundle\PostgresSchemaBundle::class => ['all' => true], +]; ``` ## Configuration @@ -41,6 +41,33 @@ doctrine: default: wrapper_class: Macpaw\PostgresSchemaBundle\Doctrine\SchemaConnection ``` + +Set `SchemaResolver` to `SchemaConnection` at kernel boot +```php +# src/Kernel.php + +use Macpaw\PostgresSchemaBundle\Doctrine\SchemaConnection; +use Macpaw\SchemaContextBundle\Service\SchemaResolver; +use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; +use Symfony\Component\HttpKernel\Kernel as BaseKernel; + +class Kernel extends BaseKernel +{ + use MicroKernelTrait; + + public function boot(): void + { + parent::boot(); + + SchemaConnection::setSchemaResolver( + $this->getContainer()->get(SchemaResolver::class), + ); + } + + // ... +} +``` + Make sure you configure the context bundle properly: See https://github.com/MacPaw/schema-context-bundle/blob/develop/README.md From 6a8155bac36aba7b043c10c669b44c7e31c57f21 Mon Sep 17 00:00:00 2001 From: Aleksey Tupichenkov Date: Fri, 29 Aug 2025 14:49:02 +0300 Subject: [PATCH 2/4] 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 3/4] 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], ]; ``` From bbebdb7d47d2dce8efbc6099e6ff8ccbed242a8a Mon Sep 17 00:00:00 2001 From: Aleksey Tupichenkov Date: Mon, 1 Sep 2025 09:59:13 +0300 Subject: [PATCH 4/4] chore: add MIT license --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7aab1b6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 MacPaw Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.