public function append(DomainEvent $event) { if ($event->getAggregateIdentity() !== $this->identity) { throw new CorruptAggregateHistory('Event Identity is not matching the eventstreams\'s identity'); } $this->events[] = $event; }
public function handle(DomainEvent $event) { $entity = new User((string) $event->getAggregateIdentity(), $event->getName(), $event->getEmail(), $event->getPasswordHash()); $this->repo->add($entity); $this->repo->save(); }