Prooph\EventSourcing\AggregateRoot::replay PHP Метод

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

Replay past events
protected replay ( Iterator $historyEvents ) : void
$historyEvents Iterator
Результат void
    protected function replay(\Iterator $historyEvents)
    {
        foreach ($historyEvents as $pastEvent) {
            /** @var AggregateChanged $pastEvent */
            $this->version = $pastEvent->version();
            $this->apply($pastEvent);
        }
    }

Usage Example

 /**
  * @param AggregateRoot $aggregateRoot
  * @param Iterator $events
  */
 public function replayStreamEvents(AggregateRoot $aggregateRoot, Iterator $events)
 {
     $aggregateRoot->replay($events);
 }