/** * {@inheritDoc} */ public function load($id, $aggregateType, StreamName $streamName = null) { if ($this->snapshotter) { $aggregateRoot = $this->loadFromSnapshotStore($id, $streamName); if ($aggregateRoot) { return $aggregateRoot; } } $streamName = $this->determineStreamName($streamName); return $aggregateType::reconstituteFromHistory($this->eventStore->getEventsFor($streamName, $id)); }
/** * @test * @dataProvider idDataProvider * @expectedException \HelloFresh\Engine\EventStore\Exception\EventStreamNotFoundException */ public function it_throws_an_exception_when_requesting_the_stream_of_a_non_existing_aggregate($id) { $this->eventStore->getEventsFor(new StreamName('event_stream'), $id); }