Snapshoting
PHP Event Sourcing Snapshoting
Setting up
class EventSourcingConfiguration
{
public const DEFAULT_SNAPSHOT_TRIGGER_THRESHOLD = 100;
public function withSnapshotsFor(
string $aggregateClassToSnapshot, // 1.
int $thresholdTrigger = self::DEFAULT_SNAPSHOT_TRIGGER_THRESHOLD, // 2.
string $documentStore = DocumentStore::class // 3.
): static
}#[ServiceContext]
public function aggregateSnapshots()
{
return EventSourcingConfiguration::createWithDefaults()
->withSnapshotsFor(Ticket::class, 1000)
->withSnapshotsFor(Basket::class, 500, MyDocumentStore::class)
;
}Snapshot threshold
Last updated
Was this helpful?