Skip to content
Merged
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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],
];
```

Expand All @@ -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;

Expand All @@ -60,7 +60,7 @@ class Kernel extends BaseKernel
parent::boot();

SchemaConnection::setSchemaResolver(
$this->getContainer()->get(SchemaResolver::class),
$this->getContainer()->get(BaggageSchemaResolver::class),
);
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/Doctrine/SchemaConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Doctrine/SchemaConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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');

Expand All @@ -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);

Expand All @@ -83,7 +83,7 @@ public function testThrowsForUnsupportedPlatform(): void

$connection->method('getDatabasePlatform')->willReturn($platform);

$resolver = new SchemaResolver();
$resolver = new BaggageSchemaResolver();

$resolver->setSchema('test_schema');

Expand Down
Loading