PHP Класс Prooph\EventStore\Aggregate\AggregateRepository

Автор: Alexander Miertsch ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
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

Описание методов

__construct() публичный Метод

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 addAggregateRoot ( object $eventSourcedAggregateRoot )
$eventSourcedAggregateRoot object

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.

assertAggregateType() защищенный Метод

protected assertAggregateType ( object $eventSourcedAggregateRoot )
$eventSourcedAggregateRoot object

determineStreamName() защищенный Метод

Override this method in an extending repository to provide a custom name
protected determineStreamName ( string | null $aggregateId ) : StreamName
$aggregateId string | null
Результат Prooph\EventStore\Stream\StreamName

enrichEventMetadata() защищенный Метод

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
Результат Prooph\Common\Messaging\Message

extractAggregateVersion() публичный Метод

public extractAggregateVersion ( object $aggregateRoot ) : integer
$aggregateRoot object
Результат integer

getAggregateRoot() публичный Метод

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
Результат null | object

loadFromSnapshotStore() защищенный Метод

protected loadFromSnapshotStore ( string $aggregateId ) : null | object
$aggregateId string
Результат null | object

Описание свойств

$aggregateTranslator защищенное свойство

protected AggregateTranslator,Prooph\EventStore\Aggregate $aggregateTranslator
Результат Prooph\EventStore\Aggregate\AggregateTranslator

$aggregateType защищенное свойство

protected AggregateType,Prooph\EventStore\Aggregate $aggregateType
Результат AggregateType

$eventStore защищенное свойство

protected EventStore,Prooph\EventStore $eventStore
Результат Prooph\EventStore\EventStore

$identityMap защищенное свойство

protected array $identityMap
Результат array

$oneStreamPerAggregate защищенное свойство

protected bool $oneStreamPerAggregate
Результат boolean

$snapshotStore защищенное свойство

protected SnapshotStore,Prooph\EventStore\Snapshot|null $snapshotStore
Результат Prooph\EventStore\Snapshot\SnapshotStore | null

$streamName защищенное свойство

protected StreamName,Prooph\EventStore\Stream $streamName
Результат Prooph\EventStore\Stream\StreamName