loadEventsByMetadataFrom() public method

public loadEventsByMetadataFrom ( StreamName $streamName, array $metadata, null | integer $minVersion = null ) : Iterator
$streamName Prooph\EventStore\Stream\StreamName
$metadata array
$minVersion null | integer
return Iterator
Ejemplo n.º 1
0
 /**
  * @param string $aggregateId
  * @return null|object
  */
 protected function loadFromSnapshotStore($aggregateId)
 {
     $snapshot = $this->snapshotStore->get($this->aggregateType, $aggregateId);
     if (!$snapshot) {
         return;
     }
     $aggregateRoot = $snapshot->aggregateRoot();
     $streamName = $this->determineStreamName($aggregateId);
     $streamEvents = $this->eventStore->loadEventsByMetadataFrom($streamName, ['aggregate_type' => $this->aggregateType->toString(), 'aggregate_id' => $aggregateId], $snapshot->lastVersion() + 1);
     if (!$streamEvents->valid()) {
         return $aggregateRoot;
     }
     $this->aggregateTranslator->replayStreamEvents($aggregateRoot, $streamEvents);
     return $aggregateRoot;
 }
Ejemplo n.º 2
0
 /**
  * @param AggregateType $repositoryAggregateType
  * @param string $aggregateId
  * @param null|int $minVersion
  * @return Message[]
  */
 public function read(AggregateType $repositoryAggregateType, $aggregateId, $minVersion = null)
 {
     Assertion::string($aggregateId, 'AggregateId needs to be string');
     return $this->eventStore->loadEventsByMetadataFrom($this->streamName, ['aggregate_id' => $aggregateId], $minVersion);
 }
 /**
  * @param string $processId
  * @param int $minVersion
  * @return DomainEvent[]
  */
 public function getStreamOfProcess($processId, $minVersion = 0)
 {
     Assertion::uuid($processId);
     return $this->eventStore->loadEventsByMetadataFrom(new StreamName('prooph_processing_stream'), ['aggregate_id' => $processId], $minVersion);
 }
Ejemplo n.º 4
0
 /**
  * @param ProcessId $processId
  * @param int $minVersion
  * @return DomainEvent[]
  */
 public function getStreamOfProcess(ProcessId $processId, $minVersion = 0)
 {
     return $this->eventStore->loadEventsByMetadataFrom(new StreamName('prooph_processing_stream'), ['aggregate_id' => $processId->toString()], $minVersion);
 }