Ejemplo n.º 1
0
 public function append(EventStream $events)
 {
     $streamName = $events->getName();
     $events->each(function (DomainMessage $event) use($streamName) {
         $this->adapter->save($streamName, $event);
     });
 }
Ejemplo n.º 2
0
 /**
  * Replay past events
  *
  * @param EventStream $historyEvents
  *
  * @param null $version
  */
 public function replay(EventStream $historyEvents, $version = null)
 {
     if (null !== $version) {
         $this->version = $version;
     }
     $historyEvents->each(function (DomainMessage $pastEvent) {
         $this->version = $pastEvent->getVersion();
         $this->apply($pastEvent->getPayload());
     });
 }