diff --git a/baseline.xml b/baseline.xml index 2a1ccf71c..e107ec3e1 100644 --- a/baseline.xml +++ b/baseline.xml @@ -56,12 +56,16 @@ errorContext]]> - + + + projector->$method(...)]]> + + diff --git a/src/Projection/Projectionist/DefaultProjectionist.php b/src/Projection/Projectionist/DefaultProjectionist.php index 6c6652f3d..0f3e905c5 100644 --- a/src/Projection/Projectionist/DefaultProjectionist.php +++ b/src/Projection/Projectionist/DefaultProjectionist.php @@ -792,7 +792,6 @@ private function discoverNewProjections(): void new ProjectionCriteria(), function (array $projections): void { foreach ($this->projectorRepository->all() as $projector) { - foreach ($projections as $projection) { if ($projection->id() === $projector->id()) { continue 2; @@ -804,7 +803,7 @@ function (array $projections): void { $projector->id(), $projector->group(), $projector->runMode(), - ) + ), ); $this->logger?->info( diff --git a/src/Projection/Projector/MetadataProjectorAccessor.php b/src/Projection/Projector/MetadataProjectorAccessor.php index a9bb0ac43..543c406fb 100644 --- a/src/Projection/Projector/MetadataProjectorAccessor.php +++ b/src/Projection/Projector/MetadataProjectorAccessor.php @@ -1,17 +1,22 @@ > - */ + /** @var array> */ private array $subscribeCache = []; public function __construct( @@ -60,9 +65,9 @@ public function teardownMethod(): Closure|null /** * @param class-string $eventClass * - * @return iterable + * @return list */ - public function subscribeMethods(string $eventClass): iterable + public function subscribeMethods(string $eventClass): array { if (array_key_exists($eventClass, $this->subscribeCache)) { return $this->subscribeCache[$eventClass]; @@ -74,10 +79,11 @@ public function subscribeMethods(string $eventClass): iterable ); $this->subscribeCache[$eventClass] = array_map( - fn(string $method) => $this->projector->$method(...), + /** @return Closure(Message):void */ + fn (string $method) => $this->projector->$method(...), $methods, ); return $this->subscribeCache[$eventClass]; } -} \ No newline at end of file +} diff --git a/src/Projection/Projector/MetadataProjectorAccessorRepository.php b/src/Projection/Projector/MetadataProjectorAccessorRepository.php index 0734ec67d..81c4714a0 100644 --- a/src/Projection/Projector/MetadataProjectorAccessorRepository.php +++ b/src/Projection/Projector/MetadataProjectorAccessorRepository.php @@ -1,53 +1,51 @@ - */ + /** @var array */ private array $projectorsMap = []; + /** @param iterable $projectors */ public function __construct( private readonly iterable $projectors, - private readonly ProjectorMetadataFactory $metadataFactory = new AttributeProjectorMetadataFactory() + private readonly ProjectorMetadataFactory $metadataFactory = new AttributeProjectorMetadataFactory(), ) { } - /** - * @return iterable - */ + /** @return iterable */ public function all(): iterable { - if ($this->init === false) { - $this->init(); - } - - return array_values($this->projectorsMap); + return array_values($this->projectorAccessorMap()); } public function get(string $id): ProjectorAccessor|null { - if ($this->init === false) { - $this->init(); - } + $map = $this->projectorAccessorMap(); - return $this->projectorsMap[$id] ?? null; + return $map[$id] ?? null; } - private function init(): void + /** @return array */ + private function projectorAccessorMap(): array { - $this->init = true; + if ($this->projectorsMap !== []) { + return $this->projectorsMap; + } foreach ($this->projectors as $projector) { $metadata = $this->metadataFactory->metadata($projector::class); $this->projectorsMap[$metadata->id] = new MetadataProjectorAccessor($projector, $metadata); } + + return $this->projectorsMap; } -} \ No newline at end of file +} diff --git a/src/Projection/Projector/ProjectorAccessor.php b/src/Projection/Projector/ProjectorAccessor.php index 481d86514..00e378da5 100644 --- a/src/Projection/Projector/ProjectorAccessor.php +++ b/src/Projection/Projector/ProjectorAccessor.php @@ -1,8 +1,11 @@ + * @return list */ - public function subscribeMethods(string $eventClass): iterable; -} \ No newline at end of file + public function subscribeMethods(string $eventClass): array; +} diff --git a/src/Projection/Projector/ProjectorAccessorRepository.php b/src/Projection/Projector/ProjectorAccessorRepository.php index 4a7ecc1bd..267a97e51 100644 --- a/src/Projection/Projector/ProjectorAccessorRepository.php +++ b/src/Projection/Projector/ProjectorAccessorRepository.php @@ -1,13 +1,13 @@ - */ + /** @return iterable */ public function all(): iterable; public function get(string $id): ProjectorAccessor|null; -} \ No newline at end of file +} diff --git a/src/Projection/Projector/TraceableProjectorAccessor.php b/src/Projection/Projector/TraceableProjectorAccessor.php index 925026d15..1ba70b22d 100644 --- a/src/Projection/Projector/TraceableProjectorAccessor.php +++ b/src/Projection/Projector/TraceableProjectorAccessor.php @@ -1,15 +1,23 @@ + * @return list */ - public function subscribeMethods(string $eventClass): iterable + public function subscribeMethods(string $eventClass): array { return array_map( - fn(Closure $closure) => ($this->wrapper)($this, $closure), - $this->parent->subscribeMethods($eventClass) + /** + * @param Closure(Message):void $closure + * + * @return Closure(Message):void + */ + fn (Closure $closure) => function (Message $message) use ($closure): void { + $trace = new Trace( + $this->id(), + 'event_sourcing/projector/' . $this->group(), + ); + + $this->traceStack->add($trace); + + try { + $closure($message); + } finally { + $this->traceStack->remove($trace); + } + }, + $this->parent->subscribeMethods($eventClass), ); } -} \ No newline at end of file +} diff --git a/src/Projection/Projector/TraceableProjectorAccessorRepository.php b/src/Projection/Projector/TraceableProjectorAccessorRepository.php index a0eec472c..cb5beb789 100644 --- a/src/Projection/Projector/TraceableProjectorAccessorRepository.php +++ b/src/Projection/Projector/TraceableProjectorAccessorRepository.php @@ -1,19 +1,17 @@ - */ + /** @var array */ private array $projectorsMap = []; public function __construct( @@ -22,53 +20,33 @@ public function __construct( ) { } - /** - * @return iterable - */ + /** @return iterable */ public function all(): iterable { - if ($this->init === false) { - $this->init(); - } - - return array_values($this->projectorsMap); + return array_values($this->projectorAccessorMap()); } - public function get(string $id): ProjectorAccessor|null + public function get(string $id): TraceableProjectorAccessor|null { - if ($this->init === false) { - $this->init(); - } + $map = $this->projectorAccessorMap(); - return $this->projectorsMap[$id] ?? null; + return $map[$id] ?? null; } - private function init(): void + /** @return array */ + private function projectorAccessorMap(): array { - $this->init = true; + if ($this->projectorsMap !== []) { + return $this->projectorsMap; + } foreach ($this->parent->all() as $projectorAccessor) { $this->projectorsMap[$projectorAccessor->id()] = new TraceableProjectorAccessor( $projectorAccessor, - $this->wrapper(...) + $this->traceStack, ); } - } - - public function wrapper($projectorAccessor, Closure $closure): Closure - { - return function (Message $message) use ($projectorAccessor, $closure) { - $trace = new Trace( - $projectorAccessor->id(), - 'event_sourcing:' . $projectorAccessor->group() - ); - $this->traceStack->add($trace); - try { - return $closure($message); - } finally { - $this->traceStack->remove($trace); - } - }; + return $this->projectorsMap; } -} \ No newline at end of file +} diff --git a/src/Repository/MessageDecorator/Trace.php b/src/Repository/MessageDecorator/Trace.php index 9de767192..bcc2357b3 100644 --- a/src/Repository/MessageDecorator/Trace.php +++ b/src/Repository/MessageDecorator/Trace.php @@ -1,13 +1,15 @@ withHeader('trace', array_map( - fn (Trace $trace) => [ - 'id' => $trace->name, - 'type' => $trace->category, - ], - $traces + return $message->withHeader(new TraceHeader( + array_map( + static fn (Trace $trace) => [ + 'name' => $trace->name, + 'category' => $trace->category, + ], + $traces, + ), )); } -} \ No newline at end of file +} diff --git a/src/Repository/MessageDecorator/TraceHeader.php b/src/Repository/MessageDecorator/TraceHeader.php new file mode 100644 index 000000000..c7c10d231 --- /dev/null +++ b/src/Repository/MessageDecorator/TraceHeader.php @@ -0,0 +1,18 @@ + $traces */ + public function __construct( + public readonly array $traces, + ) { + } +} diff --git a/src/Repository/MessageDecorator/TraceStack.php b/src/Repository/MessageDecorator/TraceStack.php index 1fd0400d5..24b71b9e3 100644 --- a/src/Repository/MessageDecorator/TraceStack.php +++ b/src/Repository/MessageDecorator/TraceStack.php @@ -1,21 +1,23 @@ - */ + /** @var array */ private array $traces = []; public function add(Trace $trace): void { - $this->traces[$trace->name] = $trace; + $this->traces[self::key($trace)] = $trace; } - /** - * @return iterable - */ + /** @return list */ public function get(): array { return array_values($this->traces); @@ -23,11 +25,11 @@ public function get(): array public function remove(Trace $trace): void { - unset($this->traces[$trace->name]); + unset($this->traces[self::key($trace)]); } private static function key(Trace $trace): string { return $trace->category . '#' . $trace->name; } -} \ No newline at end of file +} diff --git a/tests/Integration/Projectionist/Aggregate/Profile.php b/tests/Integration/Projectionist/Aggregate/Profile.php index 7c5599d62..64a4378a5 100644 --- a/tests/Integration/Projectionist/Aggregate/Profile.php +++ b/tests/Integration/Projectionist/Aggregate/Profile.php @@ -11,7 +11,6 @@ use Patchlevel\EventSourcing\Serializer\Normalizer\IdNormalizer; use Patchlevel\EventSourcing\Tests\Integration\Projectionist\Events\NameChanged; use Patchlevel\EventSourcing\Tests\Integration\Projectionist\Events\ProfileCreated; -use Patchlevel\EventSourcing\Tests\Integration\Projectionist\Events\Reborned; use Patchlevel\EventSourcing\Tests\Integration\Projectionist\ProfileId; #[Aggregate('profile')] @@ -35,11 +34,6 @@ public function changeName(string $name): void $this->recordThat(new NameChanged($name)); } - public function reborn(string $name): void - { - $this->recordThat(new Reborned($name)); - } - #[Apply] protected function applyProfileCreated(ProfileCreated $event): void { @@ -53,12 +47,6 @@ protected function applyNameChanged(NameChanged $event): void $this->name = $event->name; } - #[Apply] - protected function applyReborned(Reborned $event): void - { - $this->name = $event->name; - } - public function name(): string { return $this->name; diff --git a/tests/Integration/Projectionist/Events/Reborned.php b/tests/Integration/Projectionist/Events/Reborned.php deleted file mode 100644 index 2bbcb6acd..000000000 --- a/tests/Integration/Projectionist/Events/Reborned.php +++ /dev/null @@ -1,16 +0,0 @@ -save($profile); } - - #[Subscribe(NameChanged::class)] - public function handleNameChanged(Message $message) - { - $id = ProfileId::fromString($message->aggregateId()); - - $repository = $this->repositoryManager->get(Profile::class); - - $profile = $repository->load($id); - - $profile->reborn('neo'); - - $repository->save($profile); - } } diff --git a/tests/Integration/Projectionist/ProjectionistTest.php b/tests/Integration/Projectionist/ProjectionistTest.php index 840cf35e6..0b5ca0c50 100644 --- a/tests/Integration/Projectionist/ProjectionistTest.php +++ b/tests/Integration/Projectionist/ProjectionistTest.php @@ -8,6 +8,7 @@ use Doctrine\DBAL\Connection; use Patchlevel\EventSourcing\Clock\FrozenClock; use Patchlevel\EventSourcing\EventBus\DefaultEventBus; +use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\EventBus\Serializer\DefaultHeadersSerializer; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; use Patchlevel\EventSourcing\Projection\Projection\Projection; @@ -20,19 +21,22 @@ use Patchlevel\EventSourcing\Projection\Projector\TraceableProjectorAccessorRepository; use Patchlevel\EventSourcing\Projection\RetryStrategy\ClockBasedRetryStrategy; use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager; -use Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceDecorator; +use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceHeader; use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceStack; +use Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; use Patchlevel\EventSourcing\Serializer\DefaultEventSerializer; use Patchlevel\EventSourcing\Store\DoctrineDbalStore; use Patchlevel\EventSourcing\Tests\DbalManager; use Patchlevel\EventSourcing\Tests\Integration\Projectionist\Aggregate\Profile; -use Patchlevel\EventSourcing\Tests\Integration\Projectionist\Projection\ProfileProcessor; use Patchlevel\EventSourcing\Tests\Integration\Projectionist\Projection\ErrorProducerProjector; +use Patchlevel\EventSourcing\Tests\Integration\Projectionist\Projection\ProfileProcessor; use Patchlevel\EventSourcing\Tests\Integration\Projectionist\Projection\ProfileProjector; use PHPUnit\Framework\TestCase; +use function iterator_to_array; + /** @coversNothing */ final class ProjectionistTest extends TestCase { @@ -133,8 +137,10 @@ public function testHappyPath(): void $projectionist->projections(), ); - $result = $this->projectionConnection->fetchAssociative('SELECT * FROM projection_profile_1 WHERE id = ?', - ['1']); + $result = $this->projectionConnection->fetchAssociative( + 'SELECT * FROM projection_profile_1 WHERE id = ?', + ['1'], + ); self::assertIsArray($result); self::assertArrayHasKey('id', $result); @@ -295,12 +301,15 @@ public function testErrorHandling(): void self::assertEquals(0, $projection->retryAttempt()); } - public function testProcessor(): void { $store = new DoctrineDbalStore( $this->connection, DefaultEventSerializer::createFromPaths([__DIR__ . '/Events']), + DefaultHeadersSerializer::createFromPaths([ + __DIR__ . '/../../../src', + __DIR__, + ]), 'eventstore', ); @@ -318,14 +327,12 @@ public function testProcessor(): void $store, DefaultEventBus::create(), null, - new TraceDecorator($traceStack) + new TraceDecorator($traceStack), ); $projectorAccessorRepository = new TraceableProjectorAccessorRepository( - new MetadataProjectorAccessorRepository([ - new ProfileProcessor($manager) - ]), - $traceStack + new MetadataProjectorAccessorRepository([new ProfileProcessor($manager)]), + $traceStack, ); $repository = $manager->get(Profile::class); @@ -347,7 +354,7 @@ public function testProcessor(): void ); self::assertEquals( - [new Projection('profile_change_name', lastSavedAt: new DateTimeImmutable('2021-01-01T00:00:00'))], + [new Projection('profile', lastSavedAt: new DateTimeImmutable('2021-01-01T00:00:00'))], $projectionist->projections(), ); @@ -356,7 +363,7 @@ public function testProcessor(): void self::assertEquals( [ new Projection( - 'profile_change_name', + 'profile', Projection::DEFAULT_GROUP, RunMode::FromBeginning, ProjectionStatus::Active, @@ -371,23 +378,32 @@ public function testProcessor(): void $projectionist->run(); - self::assertEquals( - [ - new Projection( - 'profile_change_name', - Projection::DEFAULT_GROUP, - RunMode::FromBeginning, - ProjectionStatus::Active, - 3, - lastSavedAt: new DateTimeImmutable('2021-01-01T00:00:00'), - ), - ], - $projectionist->projections(), - ); + $projections = $projectionist->projections(); + + self::assertCount(1, $projections); + self::assertArrayHasKey(0, $projections); - $events = $store->load(); + $projection = $projections[0]; - dd(iterator_to_array($events)); + self::assertEquals('profile', $projection->id()); + + self::assertEquals(ProjectionStatus::Active, $projection->status()); + + /** @var list $messages */ + $messages = iterator_to_array($store->load()); + + self::assertCount(2, $messages); + self::assertArrayHasKey(1, $messages); + + self::assertEquals( + new TraceHeader([ + [ + 'name' => 'profile', + 'category' => 'event_sourcing/projector/default', + ], + ]), + $messages[1]->header(TraceHeader::class), + ); } /** @param list $projections */ diff --git a/tests/Unit/Projection/Projectionist/DefaultProjectionistTest.php b/tests/Unit/Projection/Projectionist/DefaultProjectionistTest.php index 335065027..b87f83e0b 100644 --- a/tests/Unit/Projection/Projectionist/DefaultProjectionistTest.php +++ b/tests/Unit/Projection/Projectionist/DefaultProjectionistTest.php @@ -21,6 +21,7 @@ use Patchlevel\EventSourcing\Projection\Projection\ThrowableToErrorContextTransformer; use Patchlevel\EventSourcing\Projection\Projectionist\DefaultProjectionist; use Patchlevel\EventSourcing\Projection\Projectionist\ProjectionistCriteria; +use Patchlevel\EventSourcing\Projection\Projector\MetadataProjectorAccessorRepository; use Patchlevel\EventSourcing\Projection\RetryStrategy\RetryStrategy; use Patchlevel\EventSourcing\Store\ArrayStream; use Patchlevel\EventSourcing\Store\Criteria; @@ -49,7 +50,7 @@ public function testNothingToBoot(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $store, - [], + new MetadataProjectorAccessorRepository([]), ); $projectionist->boot(); @@ -73,7 +74,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->boot(); @@ -122,7 +123,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->boot(); @@ -182,7 +183,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->boot(); @@ -254,7 +255,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->boot(new ProjectionistCriteria(), 1); @@ -338,7 +339,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector1, $projector2], + new MetadataProjectorAccessorRepository([$projector1, $projector2]), ); $projectionist->boot(); @@ -405,7 +406,7 @@ public function create(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->boot(); @@ -462,7 +463,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->boot(); @@ -518,7 +519,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->boot(); @@ -567,7 +568,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->boot(); @@ -616,7 +617,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->boot(); @@ -654,7 +655,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->run(); @@ -700,7 +701,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->run(); @@ -753,7 +754,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->run(new ProjectionistCriteria(), 1); @@ -821,7 +822,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector1, $projector2], + new MetadataProjectorAccessorRepository([$projector1, $projector2]), ); $projectionist->run(); @@ -881,7 +882,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->run(); @@ -924,7 +925,7 @@ public function testRunningMarkOutdated(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [], + new MetadataProjectorAccessorRepository([]), ); $projectionist->run(); @@ -959,7 +960,7 @@ public function testRunningWithoutActiveProjectors(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [], + new MetadataProjectorAccessorRepository([]), ); $projectionist->run(); @@ -1000,7 +1001,7 @@ public function handle(Message $message): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->run(); @@ -1031,7 +1032,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->teardown(); @@ -1067,7 +1068,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->teardown(); @@ -1105,7 +1106,7 @@ public function drop(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->teardown(); @@ -1144,7 +1145,7 @@ public function drop(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->teardown(); @@ -1171,7 +1172,7 @@ public function testTeardownWithoutProjector(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [], + new MetadataProjectorAccessorRepository([]), ); $projectionist->teardown(); @@ -1193,7 +1194,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->remove(); @@ -1235,7 +1236,7 @@ public function drop(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->remove(); @@ -1265,7 +1266,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->remove(); @@ -1301,7 +1302,7 @@ public function drop(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->remove(); @@ -1327,7 +1328,7 @@ public function testRemoveWithoutProjector(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [], + new MetadataProjectorAccessorRepository([]), ); $projectionist->remove(); @@ -1349,7 +1350,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->reactivate(); @@ -1387,7 +1388,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->reactivate(); @@ -1424,7 +1425,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->reactivate(); @@ -1460,7 +1461,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->reactivate(); @@ -1496,7 +1497,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->reactivate(); @@ -1524,7 +1525,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->pause(); @@ -1560,7 +1561,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->pause(); @@ -1596,7 +1597,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->pause(); @@ -1634,7 +1635,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->pause(); @@ -1664,7 +1665,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projections = $projectionist->projections(); @@ -1722,7 +1723,7 @@ public function subscribe(): void $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), $retryStrategy->reveal(), ); @@ -1774,7 +1775,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore, - [$projector], + new MetadataProjectorAccessorRepository([$projector]), $retryStrategy->reveal(), ); @@ -1809,7 +1810,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore->reveal(), - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionistCriteria = new ProjectionistCriteria( @@ -1849,7 +1850,7 @@ class { $projectionist = new DefaultProjectionist( $streamableStore->reveal(), $projectionStore->reveal(), - [$projector], + new MetadataProjectorAccessorRepository([$projector]), ); $projectionist->{$method}();