Skip to content

InMemoryEventStore

  • Full name: \Codefy\Domain\EventSourcing\InMemoryEventStore
  • This class is marked as final and can't be subclassed
  • This class implements: \Codefy\Domain\EventSourcing\EventStore
  • This class is a Final class

Properties

events

private array $events

Methods

append

Append a domain event to the event store.

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

Parameters:

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

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

Throws:


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