diff --git a/src/AggregateRepository.php b/src/AggregateRepository.php index 2f00dfc..4a88a26 100644 --- a/src/AggregateRepository.php +++ b/src/AggregateRepository.php @@ -58,6 +58,7 @@ public function saveAggregateRoot(AggregateRoot $aggregateRoot): void $streamEvents = new \ArrayIterator($events); $streamName = new StreamName($this->streamName()); + try { $this->eventStore->appendTo($streamName, $streamEvents); } catch (StreamNotFound $e) { @@ -73,7 +74,7 @@ public function getAggregateRoot(UuidInterface $aggregateId): ?AggregateRoot $metadataMatcher = new MetadataMatcher(); $aggregateType = $this->aggregateType(); $metadataMatcher = $metadataMatcher->withMetadataMatch('_aggregateType', Operator::EQUALS(), $aggregateType); - $metadataMatcher = $metadataMatcher->withMetadataMatch('_aggregateId', Operator::EQUALS(), (string) $aggregateId); + $metadataMatcher = $metadataMatcher->withMetadataMatch('_aggregateId', Operator::EQUALS(), (string)$aggregateId); try { $streamEvents = $this->eventStore->load($streamName, 1, null, $metadataMatcher);