diff --git a/docs/pages/getting_started.md b/docs/pages/getting_started.md index 66e437737..ca32cfb02 100644 --- a/docs/pages/getting_started.md +++ b/docs/pages/getting_started.md @@ -341,12 +341,12 @@ So that we can actually write the data to a database, we need the associated schema and databases. ```php -use Patchlevel\EventSourcing\Schema\ChainSchemaConfigurator; +use Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; $schemaDirector = new DoctrineSchemaDirector( $connection, - new ChainSchemaConfigurator([ + new ChainDoctrineSchemaConfigurator([ $eventStore, $projectionStore ]) diff --git a/docs/pages/projection.md b/docs/pages/projection.md index 52c3a61dd..ecfe7916f 100644 --- a/docs/pages/projection.md +++ b/docs/pages/projection.md @@ -430,12 +430,12 @@ Using `ChainSchemaConfigurator` we can add multiple schema configurators. In our case they need the `SchemaConfigurator` from the event store and projection store. ```php -use Patchlevel\EventSourcing\Schema\ChainSchemaConfigurator; +use Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; $schemaDirector = new DoctrineSchemaDirector( $connection - new ChainSchemaConfigurator([ + new ChainDoctrineSchemaConfigurator([ $eventStore, $projectionStore ]), diff --git a/src/Outbox/DoctrineOutboxStore.php b/src/Outbox/DoctrineOutboxStore.php index 46e253e7b..f8766013d 100644 --- a/src/Outbox/DoctrineOutboxStore.php +++ b/src/Outbox/DoctrineOutboxStore.php @@ -10,14 +10,14 @@ use Patchlevel\EventSourcing\EventBus\HeaderNotFound; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\EventBus\Serializer\MessageSerializer; -use Patchlevel\EventSourcing\Schema\SchemaConfigurator; +use Patchlevel\EventSourcing\Schema\DoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Store\WrongQueryResult; use function array_map; use function is_int; use function is_string; -final class DoctrineOutboxStore implements OutboxStore, SchemaConfigurator +final class DoctrineOutboxStore implements OutboxStore, DoctrineSchemaConfigurator { public const HEADER_OUTBOX_IDENTIFIER = 'outboxIdentifier'; diff --git a/src/Projection/Projection/Store/DoctrineStore.php b/src/Projection/Projection/Store/DoctrineStore.php index 7e437c474..2c0a9d390 100644 --- a/src/Projection/Projection/Store/DoctrineStore.php +++ b/src/Projection/Projection/Store/DoctrineStore.php @@ -21,7 +21,7 @@ use Patchlevel\EventSourcing\Projection\Projection\ProjectionNotFound; use Patchlevel\EventSourcing\Projection\Projection\ProjectionStatus; use Patchlevel\EventSourcing\Projection\Projection\RunMode; -use Patchlevel\EventSourcing\Schema\SchemaConfigurator; +use Patchlevel\EventSourcing\Schema\DoctrineSchemaConfigurator; use Psr\Clock\ClockInterface; use function array_map; @@ -44,7 +44,7 @@ * last_saved_at: string, * } */ -final class DoctrineStore implements LockableProjectionStore, SchemaConfigurator +final class DoctrineStore implements LockableProjectionStore, DoctrineSchemaConfigurator { public function __construct( private readonly Connection $connection, diff --git a/src/Schema/ChainSchemaConfigurator.php b/src/Schema/ChainDoctrineSchemaConfigurator.php similarity index 75% rename from src/Schema/ChainSchemaConfigurator.php rename to src/Schema/ChainDoctrineSchemaConfigurator.php index 59d3ea95c..d4c3bd15c 100644 --- a/src/Schema/ChainSchemaConfigurator.php +++ b/src/Schema/ChainDoctrineSchemaConfigurator.php @@ -7,9 +7,9 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Schema\Schema; -final class ChainSchemaConfigurator implements SchemaConfigurator +final class ChainDoctrineSchemaConfigurator implements DoctrineSchemaConfigurator { - /** @param iterable $schemaConfigurator */ + /** @param iterable $schemaConfigurator */ public function __construct( private readonly iterable $schemaConfigurator, ) { diff --git a/src/Schema/SchemaConfigurator.php b/src/Schema/DoctrineSchemaConfigurator.php similarity index 86% rename from src/Schema/SchemaConfigurator.php rename to src/Schema/DoctrineSchemaConfigurator.php index 24d34302a..f21215757 100644 --- a/src/Schema/SchemaConfigurator.php +++ b/src/Schema/DoctrineSchemaConfigurator.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Schema\Schema; -interface SchemaConfigurator +interface DoctrineSchemaConfigurator { public function configureSchema(Schema $schema, Connection $connection): void; } diff --git a/src/Schema/DoctrineSchemaDirector.php b/src/Schema/DoctrineSchemaDirector.php index 315e83c2d..da721b51e 100644 --- a/src/Schema/DoctrineSchemaDirector.php +++ b/src/Schema/DoctrineSchemaDirector.php @@ -13,7 +13,7 @@ final class DoctrineSchemaDirector implements DryRunSchemaDirector, DoctrineSche { public function __construct( private readonly Connection $connection, - private readonly SchemaConfigurator $schemaConfigurator, + private readonly DoctrineSchemaConfigurator $schemaConfigurator, ) { } diff --git a/src/Schema/DoctrineSchemaSubscriber.php b/src/Schema/DoctrineSchemaSubscriber.php index 861acae5f..9db0ea30e 100644 --- a/src/Schema/DoctrineSchemaSubscriber.php +++ b/src/Schema/DoctrineSchemaSubscriber.php @@ -13,7 +13,7 @@ final class DoctrineSchemaSubscriber implements EventSubscriber { public function __construct( - private readonly SchemaConfigurator $schemaConfigurator, + private readonly DoctrineSchemaConfigurator $schemaConfigurator, ) { } diff --git a/src/Store/DoctrineDbalStore.php b/src/Store/DoctrineDbalStore.php index 1112ae09a..3725746fc 100644 --- a/src/Store/DoctrineDbalStore.php +++ b/src/Store/DoctrineDbalStore.php @@ -13,7 +13,7 @@ use Doctrine\DBAL\Types\Types; use Patchlevel\EventSourcing\EventBus\HeaderNotFound; use Patchlevel\EventSourcing\EventBus\Message; -use Patchlevel\EventSourcing\Schema\SchemaConfigurator; +use Patchlevel\EventSourcing\Schema\DoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Serializer\EventSerializer; use function array_fill; @@ -24,7 +24,7 @@ use function is_string; use function sprintf; -final class DoctrineDbalStore implements Store, ArchivableStore, SchemaConfigurator +final class DoctrineDbalStore implements Store, ArchivableStore, DoctrineSchemaConfigurator { /** * PostgreSQL has a limit of 65535 parameters in a single query. diff --git a/tests/Benchmark/ProjectionistBench.php b/tests/Benchmark/ProjectionistBench.php index 58541394f..da4eaeb30 100644 --- a/tests/Benchmark/ProjectionistBench.php +++ b/tests/Benchmark/ProjectionistBench.php @@ -12,7 +12,7 @@ use Patchlevel\EventSourcing\Projection\Projectionist\Projectionist; use Patchlevel\EventSourcing\Repository\DefaultRepository; use Patchlevel\EventSourcing\Repository\Repository; -use Patchlevel\EventSourcing\Schema\ChainSchemaConfigurator; +use Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; use Patchlevel\EventSourcing\Serializer\DefaultEventSerializer; use Patchlevel\EventSourcing\Store\DoctrineDbalStore; @@ -55,7 +55,7 @@ public function setUp(): void $schemaDirector = new DoctrineSchemaDirector( $connection, - new ChainSchemaConfigurator([ + new ChainDoctrineSchemaConfigurator([ $this->store, $projectionStore, ]), diff --git a/tests/Integration/Outbox/OutboxTest.php b/tests/Integration/Outbox/OutboxTest.php index 4cb409571..b7ecf3015 100644 --- a/tests/Integration/Outbox/OutboxTest.php +++ b/tests/Integration/Outbox/OutboxTest.php @@ -12,7 +12,7 @@ use Patchlevel\EventSourcing\Outbox\OutboxEventBus; use Patchlevel\EventSourcing\Outbox\StoreOutboxProcessor; use Patchlevel\EventSourcing\Repository\DefaultRepository; -use Patchlevel\EventSourcing\Schema\ChainSchemaConfigurator; +use Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; use Patchlevel\EventSourcing\Serializer\DefaultEventSerializer; use Patchlevel\EventSourcing\Store\DoctrineDbalStore; @@ -64,7 +64,7 @@ public function testSuccessful(): void $schemaDirector = new DoctrineSchemaDirector( $this->connection, - new ChainSchemaConfigurator([ + new ChainDoctrineSchemaConfigurator([ $store, $outboxStore, ]), diff --git a/tests/Integration/Projectionist/ProjectionistTest.php b/tests/Integration/Projectionist/ProjectionistTest.php index 4d279ae60..6e3e0e345 100644 --- a/tests/Integration/Projectionist/ProjectionistTest.php +++ b/tests/Integration/Projectionist/ProjectionistTest.php @@ -17,7 +17,7 @@ use Patchlevel\EventSourcing\Projection\Projectionist\ProjectionistCriteria; use Patchlevel\EventSourcing\Projection\RetryStrategy\ClockBasedRetryStrategy; use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager; -use Patchlevel\EventSourcing\Schema\ChainSchemaConfigurator; +use Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; use Patchlevel\EventSourcing\Serializer\DefaultEventSerializer; use Patchlevel\EventSourcing\Store\DoctrineDbalStore; @@ -70,7 +70,7 @@ public function testHappyPath(): void $schemaDirector = new DoctrineSchemaDirector( $this->connection, - new ChainSchemaConfigurator([ + new ChainDoctrineSchemaConfigurator([ $store, $projectionStore, ]), @@ -167,7 +167,7 @@ public function testErrorHandling(): void $schemaDirector = new DoctrineSchemaDirector( $this->connection, - new ChainSchemaConfigurator([ + new ChainDoctrineSchemaConfigurator([ $store, $projectionStore, ]), diff --git a/tests/Unit/Schema/ChainSchemaConfiguratorTest.php b/tests/Unit/Schema/ChainDoctrineSchemaConfiguratorTest.php similarity index 60% rename from tests/Unit/Schema/ChainSchemaConfiguratorTest.php rename to tests/Unit/Schema/ChainDoctrineSchemaConfiguratorTest.php index e210cc366..7e85ca226 100644 --- a/tests/Unit/Schema/ChainSchemaConfiguratorTest.php +++ b/tests/Unit/Schema/ChainDoctrineSchemaConfiguratorTest.php @@ -6,13 +6,13 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Schema\Schema; -use Patchlevel\EventSourcing\Schema\ChainSchemaConfigurator; -use Patchlevel\EventSourcing\Schema\SchemaConfigurator; +use Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator; +use Patchlevel\EventSourcing\Schema\DoctrineSchemaConfigurator; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; -/** @covers \Patchlevel\EventSourcing\Schema\ChainSchemaConfigurator */ -final class ChainSchemaConfiguratorTest extends TestCase +/** @covers \Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator */ +final class ChainDoctrineSchemaConfiguratorTest extends TestCase { use ProphecyTrait; @@ -21,12 +21,12 @@ public function testChain(): void $schema = $this->prophesize(Schema::class)->reveal(); $connection = $this->prophesize(Connection::class)->reveal(); - $configurator1 = $this->prophesize(SchemaConfigurator::class); + $configurator1 = $this->prophesize(DoctrineSchemaConfigurator::class); $configurator1->configureSchema($schema, $connection)->shouldBeCalledOnce(); - $configurator2 = $this->prophesize(SchemaConfigurator::class); + $configurator2 = $this->prophesize(DoctrineSchemaConfigurator::class); $configurator2->configureSchema($schema, $connection)->shouldBeCalledOnce(); - $chain = new ChainSchemaConfigurator([ + $chain = new ChainDoctrineSchemaConfigurator([ $configurator1->reveal(), $configurator2->reveal(), ]); diff --git a/tests/Unit/Schema/DoctrineSchemaDirectorTest.php b/tests/Unit/Schema/DoctrineSchemaDirectorTest.php index d5ebcdf08..49ea9ae14 100644 --- a/tests/Unit/Schema/DoctrineSchemaDirectorTest.php +++ b/tests/Unit/Schema/DoctrineSchemaDirectorTest.php @@ -11,8 +11,8 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaConfig; use Doctrine\DBAL\Schema\SchemaDiff; +use Patchlevel\EventSourcing\Schema\DoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; -use Patchlevel\EventSourcing\Schema\SchemaConfigurator; use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; @@ -36,7 +36,7 @@ public function testCreate(): void $connection->getDatabasePlatform()->willReturn($platform->reveal()); $connection->executeStatement('this is sql!')->shouldBeCalledOnce(); - $schemaConfigurator = $this->prophesize(SchemaConfigurator::class); + $schemaConfigurator = $this->prophesize(DoctrineSchemaConfigurator::class); $schemaConfigurator->configureSchema(Argument::type(Schema::class), $connection->reveal())->shouldBeCalledOnce(); $doctrineSchemaManager = new DoctrineSchemaDirector( @@ -60,7 +60,7 @@ public function testDryRunCreate(): void $connection->createSchemaManager()->willReturn($schemaManager->reveal()); $connection->getDatabasePlatform()->willReturn($platform->reveal()); - $schemaConfigurator = $this->prophesize(SchemaConfigurator::class); + $schemaConfigurator = $this->prophesize(DoctrineSchemaConfigurator::class); $schemaConfigurator->configureSchema(Argument::type(Schema::class), $connection->reveal())->shouldBeCalledOnce(); $doctrineSchemaManager = new DoctrineSchemaDirector( @@ -96,7 +96,7 @@ public function testUpdate(): void $connection->executeStatement('x')->shouldBeCalledOnce(); $connection->executeStatement('y')->shouldBeCalledOnce(); - $schemaConfigurator = $this->prophesize(SchemaConfigurator::class); + $schemaConfigurator = $this->prophesize(DoctrineSchemaConfigurator::class); $schemaConfigurator->configureSchema(Argument::type(Schema::class), $connection->reveal())->shouldBeCalledOnce(); $doctrineSchemaManager = new DoctrineSchemaDirector( @@ -128,7 +128,7 @@ public function testDryRunUpdate(): void $connection->createSchemaManager()->willReturn($schemaManager->reveal()); $connection->getDatabasePlatform()->willReturn($platform->reveal()); - $schemaConfigurator = $this->prophesize(SchemaConfigurator::class); + $schemaConfigurator = $this->prophesize(DoctrineSchemaConfigurator::class); $schemaConfigurator->configureSchema(Argument::type(Schema::class), $connection->reveal())->shouldBeCalledOnce(); $doctrineSchemaManager = new DoctrineSchemaDirector( @@ -157,7 +157,7 @@ public function testDrop(): void $connection->executeStatement('DROP TABLE foo;')->shouldBeCalled(); $connection->executeStatement('DROP TABLE bar;')->shouldNotBeCalled(); - $schemaConfigurator = $this->prophesize(SchemaConfigurator::class); + $schemaConfigurator = $this->prophesize(DoctrineSchemaConfigurator::class); $schemaConfigurator->configureSchema(Argument::that(static function (Schema $schema) { $schema->createTable('foo'); $schema->createTable('bar'); @@ -186,7 +186,7 @@ public function testDryRunDrop(): void $schemaManager->introspectSchema()->willReturn($currentSchema->reveal()); $connection->createSchemaManager()->willReturn($schemaManager->reveal()); - $schemaConfigurator = $this->prophesize(SchemaConfigurator::class); + $schemaConfigurator = $this->prophesize(DoctrineSchemaConfigurator::class); $schemaConfigurator->configureSchema(Argument::that(static function (Schema $schema) { $schema->createTable('foo'); $schema->createTable('bar'); diff --git a/tests/Unit/Schema/DoctrineSchemaSubscriberTest.php b/tests/Unit/Schema/DoctrineSchemaSubscriberTest.php index 89d91000f..582193ca4 100644 --- a/tests/Unit/Schema/DoctrineSchemaSubscriberTest.php +++ b/tests/Unit/Schema/DoctrineSchemaSubscriberTest.php @@ -8,8 +8,8 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs; +use Patchlevel\EventSourcing\Schema\DoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaSubscriber; -use Patchlevel\EventSourcing\Schema\SchemaConfigurator; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; @@ -25,7 +25,7 @@ public function testPostGenerateSchema(): void $em->getConnection()->willReturn($connection); $expectedSchema = new Schema(); - $schemaConfigurator = $this->prophesize(SchemaConfigurator::class); + $schemaConfigurator = $this->prophesize(DoctrineSchemaConfigurator::class); $schemaConfigurator->configureSchema($expectedSchema, $connection)->shouldBeCalled(); $event = new GenerateSchemaEventArgs($em->reveal(), $expectedSchema); @@ -36,7 +36,7 @@ public function testPostGenerateSchema(): void public function testGetSubscribedEvents(): void { - $schemaConfigurator = $this->prophesize(SchemaConfigurator::class); + $schemaConfigurator = $this->prophesize(DoctrineSchemaConfigurator::class); $doctrineSchemaSubscriber = new DoctrineSchemaSubscriber($schemaConfigurator->reveal()); $events = $doctrineSchemaSubscriber->getSubscribedEvents();