public static fromAggregateRootClass ( string $aggregateRootClass ) : |
||
$aggregateRootClass | string | |
return |
public static function fromAggregateRootClass($aggregateRootClass)
{
if (!is_string($aggregateRootClass)) {
throw new Exception\InvalidArgumentException('Aggregate root class must be a string');
}
if (!class_exists($aggregateRootClass)) {
throw new Exception\InvalidArgumentException(sprintf('Aggregate root class %s can not be found', $aggregateRootClass));
}
return new static($aggregateRootClass);
}
protected function setUp() { parent::setUp(); $this->repository = new AggregateRepository($this->eventStore, AggregateType::fromAggregateRootClass('Prooph\\EventStoreTest\\Mock\\User'), new ConfigurableAggregateTranslator()); $this->eventStore->beginTransaction(); $this->eventStore->create(new Stream(new StreamName('event_stream'), [])); $this->eventStore->commit(); }