Example #1
0
 public function track(AggregateRoot $aggregateRoot)
 {
     $recordedChanges = $aggregateRoot->getChanges();
     $aggregateRoot->clearChanges();
     foreach ($recordedChanges as $event) {
         $this->eventBus->publish($event);
     }
 }
 public function save(AggregateRoot $ar)
 {
     $es = $ar->getUncommittedEvents();
     $this->eventStore->append($ar->getAggregateRootId(), $es);
     $this->eventBus->dispatch($es);
 }