PHP Class Prooph\EventStore\Aggregate\AggregateRepository

Author: Alexander Miertsch ([email protected])
Afficher le fichier Open project: prooph/event-store Class Usage Examples

Protected Properties

Свойство Type Description
$aggregateTranslator Prooph\EventStore\Aggregate\AggregateTranslator
$aggregateType AggregateType
$eventStore Prooph\EventStore\EventStore
$identityMap array
$oneStreamPerAggregate boolean
$snapshotStore Prooph\EventStore\Snapshot\SnapshotStore | null
$streamName Prooph\EventStore\Stream\StreamName

Méthodes publiques

Méthode Description
__construct ( EventStore $eventStore, AggregateType $aggregateType, Prooph\EventStore\Aggregate\AggregateTranslator $aggregateTranslator, SnapshotStore $snapshotStore = null, StreamName $streamName = null, boolean $oneStreamPerAggregate = false )
addAggregateRoot ( object $eventSourcedAggregateRoot )
addPendingEventsToStream ( ) Repository acts as listener on EventStore.commit.pre events In the listener method the repository checks its identity map for pending events and appends the events to the event stream.
extractAggregateVersion ( object $aggregateRoot ) : integer
getAggregateRoot ( string $aggregateId ) : null | object Returns null if no stream events can be found for aggregate root otherwise the reconstituted aggregate root

Méthodes protégées

Méthode Description
assertAggregateType ( object $eventSourcedAggregateRoot )
determineStreamName ( string | null $aggregateId ) : StreamName Default stream name generation.
enrichEventMetadata ( Prooph\Common\Messaging\Message $domainEvent, string $aggregateId ) : Prooph\Common\Messaging\Message Add aggregate_id and aggregate_type as metadata to $domainEvent Override this method in an extending repository to add more or different metadata.
loadFromSnapshotStore ( string $aggregateId ) : null | object

Method Details

__construct() public méthode

public __construct ( EventStore $eventStore, AggregateType $aggregateType, Prooph\EventStore\Aggregate\AggregateTranslator $aggregateTranslator, SnapshotStore $snapshotStore = null, StreamName $streamName = null, boolean $oneStreamPerAggregate = false )
$eventStore Prooph\EventStore\EventStore
$aggregateType AggregateType
$aggregateTranslator Prooph\EventStore\Aggregate\AggregateTranslator
$snapshotStore Prooph\EventStore\Snapshot\SnapshotStore
$streamName Prooph\EventStore\Stream\StreamName
$oneStreamPerAggregate boolean

addAggregateRoot() public méthode

public addAggregateRoot ( object $eventSourcedAggregateRoot )
$eventSourcedAggregateRoot object

addPendingEventsToStream() public méthode

Repository acts as listener on EventStore.commit.pre events In the listener method the repository checks its identity map for pending events and appends the events to the event stream.

assertAggregateType() protected méthode

protected assertAggregateType ( object $eventSourcedAggregateRoot )
$eventSourcedAggregateRoot object

determineStreamName() protected méthode

Override this method in an extending repository to provide a custom name
protected determineStreamName ( string | null $aggregateId ) : StreamName
$aggregateId string | null
Résultat Prooph\EventStore\Stream\StreamName

enrichEventMetadata() protected méthode

Add aggregate_id and aggregate_type as metadata to $domainEvent Override this method in an extending repository to add more or different metadata.
protected enrichEventMetadata ( Prooph\Common\Messaging\Message $domainEvent, string $aggregateId ) : Prooph\Common\Messaging\Message
$domainEvent Prooph\Common\Messaging\Message
$aggregateId string
Résultat Prooph\Common\Messaging\Message

extractAggregateVersion() public méthode

public extractAggregateVersion ( object $aggregateRoot ) : integer
$aggregateRoot object
Résultat integer

getAggregateRoot() public méthode

Returns null if no stream events can be found for aggregate root otherwise the reconstituted aggregate root
public getAggregateRoot ( string $aggregateId ) : null | object
$aggregateId string
Résultat null | object

loadFromSnapshotStore() protected méthode

protected loadFromSnapshotStore ( string $aggregateId ) : null | object
$aggregateId string
Résultat null | object

Property Details

$aggregateTranslator protected_oe property

protected AggregateTranslator,Prooph\EventStore\Aggregate $aggregateTranslator
Résultat Prooph\EventStore\Aggregate\AggregateTranslator

$aggregateType protected_oe property

protected AggregateType,Prooph\EventStore\Aggregate $aggregateType
Résultat AggregateType

$eventStore protected_oe property

protected EventStore,Prooph\EventStore $eventStore
Résultat Prooph\EventStore\EventStore

$identityMap protected_oe property

protected array $identityMap
Résultat array

$oneStreamPerAggregate protected_oe property

protected bool $oneStreamPerAggregate
Résultat boolean

$snapshotStore protected_oe property

protected SnapshotStore,Prooph\EventStore\Snapshot|null $snapshotStore
Résultat Prooph\EventStore\Snapshot\SnapshotStore | null

$streamName protected_oe property

protected StreamName,Prooph\EventStore\Stream $streamName
Résultat Prooph\EventStore\Stream\StreamName