public function recordThat(Message $event): void
    {
        if (! \array_key_exists($event->messageName(), $this->eventApplyMap)) {
            throw new \RuntimeException('Wrong event recording detected. Unknown event passed to GenericAggregateRoot: ' . $event->messageName());
        }

        $this->version += 1;

        $event = $event->withAddedMetadata('_aggregate_id', $this->aggregateId());
        $event = $event->withAddedMetadata('_aggregate_version', $this->version);
        $this->recordedEvents[] = $event;

        $this->apply($event);
    }
public function recordThat(Message $event): void
    {
        if (! \array_key_exists($event->messageName(), $this->eventApplyMap)) {
            throw new \RuntimeException('Wrong event recording detected. Unknown event passed to GenericAggregateRoot: ' . $event->messageName());
        }

        $this->version += 1;

        $event = $event->withAddedMetadata('_aggregate_id', $this->aggregateId());
        $event = $event->withAddedMetadata('_aggregate_version', $this->version);
        $this->recordedEvents[] = $event;

        $this->apply($event);
    }
public function recordThat ( Message $ event ) : void { if ( ! \ array_key_exists ( $ event -> messageName ( ) , $ this -> eventApplyMap ) ) { throw new \ RuntimeException ( 'Wrong event recording detected. Unknown event passed to GenericAggregateRoot: ' . $ event -> messageName ( ) ) ; } $ this -> version += 1 ; $ event = $ event -> withAddedMetadata ( '_aggregate_id' , $ this -> aggregateId ( ) ) ; $ event = $ event -> withAddedMetadata ( '_aggregate_version' , $ this -> version ) ; $ this -> recordedEvents [ ] = $ event ; $ this -> apply ( $ event ) ; }
Record an aggregate changed event
Record an aggregate changed event