DoctrineEventStore
in package
implements
EventStore
Read onlyYes
FinalYes
Tags
Table of Contents
Interfaces
- EventStore
- Read/write interface for event-sourced event streams.
Methods
- __construct() : mixed
- deleteUpTo() : void
- Delete all events up to and including `$toSequenceNr` for the given actor.
- highestSequenceNr() : int
- Return the highest sequence number written for `$id`, or 0 if no events exist.
- load() : iterable<string|int, EventEnvelope>
- Load events for `$id` within the given sequence number range (inclusive).
- persist() : void
- Append one or more events to the stream identified by `$id`.
Methods
__construct()
public
__construct(EntityManagerInterface $em[, MessageSerializer $serializer = new PhpNativeSerializer() ]) : mixed
Parameters
- $em : EntityManagerInterface
- $serializer : MessageSerializer = new PhpNativeSerializer()
deleteUpTo()
Delete all events up to and including `$toSequenceNr` for the given actor.
public
deleteUpTo(PersistenceId $id, int $toSequenceNr) : void
Called by the retention policy after a snapshot is confirmed durable. Implementations should be idempotent — deleting already-deleted events is a no-op.
Parameters
- $id : PersistenceId
- $toSequenceNr : int
highestSequenceNr()
Return the highest sequence number written for `$id`, or 0 if no events exist.
public
highestSequenceNr(PersistenceId $id) : int
Used by the engine to detect writer conflicts and to set the starting point
for the next persist() call.
Parameters
- $id : PersistenceId
Return values
intload()
Load events for `$id` within the given sequence number range (inclusive).
public
load(PersistenceId $id[, int $fromSequenceNr = 0 ][, int $toSequenceNr = PHP_INT_MAX ]) : iterable<string|int, EventEnvelope>
Parameters
- $id : PersistenceId
- $fromSequenceNr : int = 0
- $toSequenceNr : int = PHP_INT_MAX
Return values
iterable<string|int, EventEnvelope>persist()
Append one or more events to the stream identified by `$id`.
public
persist(PersistenceId $id, EventEnvelope ...$events) : void
Implementations must write all events atomically and assign monotonically increasing sequence numbers. Throws on write failure.
Parameters
- $id : PersistenceId
- $events : EventEnvelope