diff --git a/docs/pages/message_decorator.md b/docs/pages/message_decorator.md index da0f86355..4bb5ac62d 100644 --- a/docs/pages/message_decorator.md +++ b/docs/pages/message_decorator.md @@ -13,8 +13,8 @@ We offer a few decorators that you can use. In order to use the [split stream](split_stream.md) feature, the `SplitStreamDecorator` must be added. ```php -use Patchlevel\EventSourcing\EventBus\Decorator\SplitStreamDecorator; use Patchlevel\EventSourcing\Metadata\Event\AttributeEventMetadataFactory; +use Patchlevel\EventSourcing\Repository\MessageDecorator\SplitStreamDecorator; $eventMetadataFactory = new AttributeEventMetadataFactory(); $decorator = new SplitStreamDecorator($eventMetadataFactory); @@ -25,7 +25,7 @@ $decorator = new SplitStreamDecorator($eventMetadataFactory); To use multiple decorators at the same time, you can use the `ChainMessageDecorator`. ```php -use Patchlevel\EventSourcing\EventBus\Decorator\ChainMessageDecorator; +use Patchlevel\EventSourcing\Repository\MessageDecorator\ChainMessageDecorator; $decorator = new ChainMessageDecorator([ $decorator1, @@ -39,9 +39,9 @@ To use the message decorator, you have to pass it to the `DefaultRepositoryManag which will then pass it to all Repositories. ```php -use Patchlevel\EventSourcing\EventBus\Decorator\ChainMessageDecorator; -use Patchlevel\EventSourcing\EventBus\Decorator\SplitStreamDecorator; use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager; +use Patchlevel\EventSourcing\Repository\MessageDecorator\ChainMessageDecorator; +use Patchlevel\EventSourcing\Repository\MessageDecorator\SplitStreamDecorator; $decorator = new ChainMessageDecorator([ new SplitStreamDecorator($eventMetadataFactory) @@ -69,6 +69,7 @@ to add data `withHeader` and to read this data later on `header`. ```php use Patchlevel\EventSourcing\EventBus\Message; +use Patchlevel\EventSourcing\Repository\MessageDecorator\MessageDecorator; final class OnSystemRecordedDecorator implements MessageDecorator { diff --git a/src/Repository/DefaultRepository.php b/src/Repository/DefaultRepository.php index c95ab5b36..37366bde5 100644 --- a/src/Repository/DefaultRepository.php +++ b/src/Repository/DefaultRepository.php @@ -7,11 +7,11 @@ use Patchlevel\EventSourcing\Aggregate\AggregateRoot; use Patchlevel\EventSourcing\Aggregate\AggregateRootId; use Patchlevel\EventSourcing\Clock\SystemClock; -use Patchlevel\EventSourcing\EventBus\Decorator\MessageDecorator; use Patchlevel\EventSourcing\EventBus\EventBus; use Patchlevel\EventSourcing\EventBus\HeaderNotFound; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootMetadata; +use Patchlevel\EventSourcing\Repository\MessageDecorator\MessageDecorator; use Patchlevel\EventSourcing\Snapshot\SnapshotNotFound; use Patchlevel\EventSourcing\Snapshot\SnapshotStore; use Patchlevel\EventSourcing\Snapshot\SnapshotVersionInvalid; diff --git a/src/Repository/DefaultRepositoryManager.php b/src/Repository/DefaultRepositoryManager.php index 7c4f7e4b7..afabf5daa 100644 --- a/src/Repository/DefaultRepositoryManager.php +++ b/src/Repository/DefaultRepositoryManager.php @@ -6,12 +6,12 @@ use Patchlevel\EventSourcing\Aggregate\AggregateRoot; use Patchlevel\EventSourcing\Clock\SystemClock; -use Patchlevel\EventSourcing\EventBus\Decorator\MessageDecorator; use Patchlevel\EventSourcing\EventBus\EventBus; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootClassNotRegistered; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootMetadataAwareMetadataFactory; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootMetadataFactory; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; +use Patchlevel\EventSourcing\Repository\MessageDecorator\MessageDecorator; use Patchlevel\EventSourcing\Snapshot\SnapshotStore; use Patchlevel\EventSourcing\Store\Store; use Psr\Clock\ClockInterface; diff --git a/src/EventBus/Decorator/ChainMessageDecorator.php b/src/Repository/MessageDecorator/ChainMessageDecorator.php similarity index 89% rename from src/EventBus/Decorator/ChainMessageDecorator.php rename to src/Repository/MessageDecorator/ChainMessageDecorator.php index 15f7e8ac0..0152c8aff 100644 --- a/src/EventBus/Decorator/ChainMessageDecorator.php +++ b/src/Repository/MessageDecorator/ChainMessageDecorator.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\EventBus\Decorator; +namespace Patchlevel\EventSourcing\Repository\MessageDecorator; use Patchlevel\EventSourcing\EventBus\Message; diff --git a/src/EventBus/Decorator/MessageDecorator.php b/src/Repository/MessageDecorator/MessageDecorator.php similarity index 72% rename from src/EventBus/Decorator/MessageDecorator.php rename to src/Repository/MessageDecorator/MessageDecorator.php index 53fba18d9..25e32acff 100644 --- a/src/EventBus/Decorator/MessageDecorator.php +++ b/src/Repository/MessageDecorator/MessageDecorator.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\EventBus\Decorator; +namespace Patchlevel\EventSourcing\Repository\MessageDecorator; use Patchlevel\EventSourcing\EventBus\Message; diff --git a/src/EventBus/Decorator/SplitStreamDecorator.php b/src/Repository/MessageDecorator/SplitStreamDecorator.php similarity index 90% rename from src/EventBus/Decorator/SplitStreamDecorator.php rename to src/Repository/MessageDecorator/SplitStreamDecorator.php index 382ec8cec..017bc33b1 100644 --- a/src/EventBus/Decorator/SplitStreamDecorator.php +++ b/src/Repository/MessageDecorator/SplitStreamDecorator.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\EventBus\Decorator; +namespace Patchlevel\EventSourcing\Repository\MessageDecorator; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\Metadata\Event\EventMetadataFactory; diff --git a/tests/Benchmark/SplitStreamBench.php b/tests/Benchmark/SplitStreamBench.php index 712be95dd..054504ab1 100644 --- a/tests/Benchmark/SplitStreamBench.php +++ b/tests/Benchmark/SplitStreamBench.php @@ -7,11 +7,11 @@ use Doctrine\DBAL\Driver\PDO\SQLite\Driver; use Doctrine\DBAL\DriverManager; use Patchlevel\EventSourcing\Aggregate\AggregateRootId; -use Patchlevel\EventSourcing\EventBus\Decorator\SplitStreamDecorator; use Patchlevel\EventSourcing\EventBus\DefaultEventBus; use Patchlevel\EventSourcing\EventBus\EventBus; use Patchlevel\EventSourcing\Metadata\Event\AttributeEventMetadataFactory; use Patchlevel\EventSourcing\Repository\DefaultRepository; +use Patchlevel\EventSourcing\Repository\MessageDecorator\SplitStreamDecorator; use Patchlevel\EventSourcing\Repository\Repository; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; use Patchlevel\EventSourcing\Serializer\DefaultEventSerializer; diff --git a/tests/Integration/BankAccountSplitStream/IntegrationTest.php b/tests/Integration/BankAccountSplitStream/IntegrationTest.php index f08e13c7a..ee33ed898 100644 --- a/tests/Integration/BankAccountSplitStream/IntegrationTest.php +++ b/tests/Integration/BankAccountSplitStream/IntegrationTest.php @@ -5,8 +5,6 @@ namespace Patchlevel\EventSourcing\Tests\Integration\BankAccountSplitStream; use Doctrine\DBAL\Connection; -use Patchlevel\EventSourcing\EventBus\Decorator\ChainMessageDecorator; -use Patchlevel\EventSourcing\EventBus\Decorator\SplitStreamDecorator; use Patchlevel\EventSourcing\EventBus\DefaultEventBus; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; use Patchlevel\EventSourcing\Metadata\Event\AttributeEventMetadataFactory; @@ -15,6 +13,8 @@ use Patchlevel\EventSourcing\Projection\Projectionist\DefaultProjectionist; use Patchlevel\EventSourcing\Projection\Projector\InMemoryProjectorRepository; use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager; +use Patchlevel\EventSourcing\Repository\MessageDecorator\ChainMessageDecorator; +use Patchlevel\EventSourcing\Repository\MessageDecorator\SplitStreamDecorator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; use Patchlevel\EventSourcing\Serializer\DefaultEventSerializer; use Patchlevel\EventSourcing\Store\DoctrineDbalStore; diff --git a/tests/Integration/BasicImplementation/MessageDecorator/FooMessageDecorator.php b/tests/Integration/BasicImplementation/MessageDecorator/FooMessageDecorator.php index 08862446e..e6ace10a4 100644 --- a/tests/Integration/BasicImplementation/MessageDecorator/FooMessageDecorator.php +++ b/tests/Integration/BasicImplementation/MessageDecorator/FooMessageDecorator.php @@ -4,8 +4,8 @@ namespace Patchlevel\EventSourcing\Tests\Integration\BasicImplementation\MessageDecorator; -use Patchlevel\EventSourcing\EventBus\Decorator\MessageDecorator; use Patchlevel\EventSourcing\EventBus\Message; +use Patchlevel\EventSourcing\Repository\MessageDecorator\MessageDecorator; final class FooMessageDecorator implements MessageDecorator { diff --git a/tests/Unit/Repository/DefaultRepositoryTest.php b/tests/Unit/Repository/DefaultRepositoryTest.php index 24f795eba..4de5e08ae 100644 --- a/tests/Unit/Repository/DefaultRepositoryTest.php +++ b/tests/Unit/Repository/DefaultRepositoryTest.php @@ -4,8 +4,6 @@ namespace Patchlevel\EventSourcing\Tests\Unit\Repository; -use Patchlevel\EventSourcing\EventBus\Decorator\MessageDecorator; -use Patchlevel\EventSourcing\EventBus\Decorator\SplitStreamDecorator; use Patchlevel\EventSourcing\EventBus\EventBus; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\Metadata\Event\AttributeEventMetadataFactory; @@ -15,6 +13,8 @@ use Patchlevel\EventSourcing\Repository\AggregateOutdated; use Patchlevel\EventSourcing\Repository\AggregateUnknown; use Patchlevel\EventSourcing\Repository\DefaultRepository; +use Patchlevel\EventSourcing\Repository\MessageDecorator\MessageDecorator; +use Patchlevel\EventSourcing\Repository\MessageDecorator\SplitStreamDecorator; use Patchlevel\EventSourcing\Repository\WrongAggregate; use Patchlevel\EventSourcing\Snapshot\SnapshotNotFound; use Patchlevel\EventSourcing\Snapshot\SnapshotStore; diff --git a/tests/Unit/EventBus/Decorator/ChainMessageDecoratorTest.php b/tests/Unit/Repository/MessageDecorator/ChainMessageDecoratorTest.php similarity index 77% rename from tests/Unit/EventBus/Decorator/ChainMessageDecoratorTest.php rename to tests/Unit/Repository/MessageDecorator/ChainMessageDecoratorTest.php index b63739ae1..619111f38 100644 --- a/tests/Unit/EventBus/Decorator/ChainMessageDecoratorTest.php +++ b/tests/Unit/Repository/MessageDecorator/ChainMessageDecoratorTest.php @@ -2,18 +2,18 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Tests\Unit\EventBus\Decorator; +namespace Patchlevel\EventSourcing\Tests\Unit\Repository\MessageDecorator; -use Patchlevel\EventSourcing\EventBus\Decorator\ChainMessageDecorator; -use Patchlevel\EventSourcing\EventBus\Decorator\MessageDecorator; use Patchlevel\EventSourcing\EventBus\Message; +use Patchlevel\EventSourcing\Repository\MessageDecorator\ChainMessageDecorator; +use Patchlevel\EventSourcing\Repository\MessageDecorator\MessageDecorator; use Patchlevel\EventSourcing\Tests\Unit\Fixture\Email; use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileCreated; use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileId; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; -/** @covers \Patchlevel\EventSourcing\EventBus\Decorator\ChainMessageDecorator */ +/** @covers \Patchlevel\EventSourcing\Repository\MessageDecorator\ChainMessageDecorator */ final class ChainMessageDecoratorTest extends TestCase { use ProphecyTrait; diff --git a/tests/Unit/EventBus/Decorator/SplitStreamDecoratorTest.php b/tests/Unit/Repository/MessageDecorator/SplitStreamDecoratorTest.php similarity index 85% rename from tests/Unit/EventBus/Decorator/SplitStreamDecoratorTest.php rename to tests/Unit/Repository/MessageDecorator/SplitStreamDecoratorTest.php index 6f4fcdaff..4564b7c8b 100644 --- a/tests/Unit/EventBus/Decorator/SplitStreamDecoratorTest.php +++ b/tests/Unit/Repository/MessageDecorator/SplitStreamDecoratorTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Tests\Unit\EventBus\Decorator; +namespace Patchlevel\EventSourcing\Tests\Unit\Repository\MessageDecorator; -use Patchlevel\EventSourcing\EventBus\Decorator\SplitStreamDecorator; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\Metadata\Event\AttributeEventMetadataFactory; +use Patchlevel\EventSourcing\Repository\MessageDecorator\SplitStreamDecorator; use Patchlevel\EventSourcing\Tests\Unit\Fixture\Email; use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileCreated; use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileId; @@ -14,7 +14,7 @@ use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; -/** @covers \Patchlevel\EventSourcing\EventBus\Decorator\SplitStreamDecorator */ +/** @covers \Patchlevel\EventSourcing\Repository\MessageDecorator\SplitStreamDecorator */ final class SplitStreamDecoratorTest extends TestCase { use ProphecyTrait;