Access Event Store
Use Event Store directly
use Ecotone\EventSourcing\EventStore;
#[QueryHandler(self::GET_CURRENT_BALANCE_QUERY)]
public function getCurrentBalance(#[Reference] EventStore $eventStore): array
{
$streamName = "wallet";
if (!$eventStore->hasStream($streamName)) {
return [];
}
/** @var Event[] $event */
$events = $eventStore->load($streamName, count: 10);
return $events;
}Last updated
Was this helpful?