Skip to content

EventSourcedAggregateRepository

Properties

eventStore

protected \Codefy\Domain\EventSourcing\EventStore $eventStore

projection

protected \Codefy\Domain\EventSourcing\Projection $projection

Methods

__construct

public __construct(\Codefy\Domain\EventSourcing\EventStore $eventStore, \Codefy\Domain\EventSourcing\Projection $projection): mixed

Parameters:

Parameter Type Description
$eventStore \Codefy\Domain\EventSourcing\EventStore
$projection \Codefy\Domain\EventSourcing\Projection

loadAggregateRoot

Loads an aggregate from the given aggregate id.

public loadAggregateRoot(\Codefy\Domain\Aggregate\AggregateId $aggregateId): \Codefy\Domain\Aggregate\RecordsEvents|null

Parameters:

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

Throws:


saveAggregateRoot

Persist an aggregate.

public saveAggregateRoot(\Codefy\Domain\Aggregate\RecordsEvents $aggregate): void

Parameters:

Parameter Type Description
$aggregate \Codefy\Domain\Aggregate\RecordsEvents

Inherited methods

attachToIdentityMap

Attach an aggregate to the map.

public attachToIdentityMap(\Codefy\Domain\Aggregate\RecordsEvents $aggregate): void

Parameters:

Parameter Type Description
$aggregate \Codefy\Domain\Aggregate\RecordsEvents

retrieveFromIdentityMap

Retrieve an aggregate from the map by its aggregate id.

public retrieveFromIdentityMap(\Codefy\Domain\Aggregate\AggregateId $aggregateId): \Codefy\Domain\Aggregate\RecordsEvents|null

Parameters:

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

clearIdentityMap

Clear the identity map.

public clearIdentityMap(): void

removeFromIdentityMap

Remove aggregate from identity map.

public removeFromIdentityMap(\Codefy\Domain\Aggregate\RecordsEvents $aggregate): void

Parameters:

Parameter Type Description
$aggregate \Codefy\Domain\Aggregate\RecordsEvents

enableIdentityMap

Set whether identity map is enabled.

public enableIdentityMap(bool $bool = true): $this

Parameters:

Parameter Type Description
$bool bool


Automatically generated on 2025-10-13