Skip to content

TransactionalEventStore

Event store for publishing a domain event and retrieving an aggregate's history.

  • Full name: \Codefy\Domain\EventSourcing\TransactionalEventStore

Methods

append

Append a domain event to the event store.

public append(\Codefy\Domain\EventSourcing\DomainEvent $event, \Codefy\Domain\EventSourcing\TransactionId $transactionId): void

Parameters:

Parameter Type Description
$event \Codefy\Domain\EventSourcing\DomainEvent
$transactionId \Codefy\Domain\EventSourcing\TransactionId

commit

Appends a list of domain events to the event store.

public commit(\Codefy\Domain\EventSourcing\DomainEvent $events): \Codefy\Domain\EventSourcing\Transactional

Parameters:

Parameter Type Description
$events \Codefy\Domain\EventSourcing\DomainEvent

getAggregateHistoryFor

Retrieve aggregate's history based on aggregate id.

public getAggregateHistoryFor(\Codefy\Domain\Aggregate\AggregateId $aggregateId): \Codefy\Domain\EventSourcing\EventStream

Parameters:

Parameter Type Description
$aggregateId \Codefy\Domain\Aggregate\AggregateId

Throws:


loadFromPlayhead

public loadFromPlayhead(\Codefy\Domain\Aggregate\AggregateId $aggregateId, int $playhead): \Codefy\Domain\EventSourcing\EventStream

Parameters:

Parameter Type Description
$aggregateId \Codefy\Domain\Aggregate\AggregateId
$playhead int

Throws:



Automatically generated on 2025-10-13