/**
* @param AggregateType $repositoryAggregateType
* @param string $aggregateId
* @param Message[] $streamEvents
* @param object $aggregateRoot
* @throws Exception\InvalidArgumentException
* @return void
*/
public function appendEvents(AggregateType $repositoryAggregateType, $aggregateId, array $streamEvents, $aggregateRoot)
{
$arType = AggregateType::fromAggregateRoot($aggregateRoot);
if (!$repositoryAggregateType->equals($arType)) {
throw new Exception\InvalidArgumentException(sprintf('aggregate root mismatch between repository type %s and object type %s', $repositoryAggregateType->toString(), $arType->toString()));
}
$this->eventStore->appendTo($this->buildStreamName($repositoryAggregateType, $aggregateId), $streamEvents);
}