Skip to content

Commit 2ad6b13

Browse files
author
Alexander Miertsch
committed
Merge pull request #33 from prolic/reconstituteAggregateFromHistory
Reconstitute aggregate from history
2 parents abda664 + 78220fb commit 2ad6b13

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/TestCase.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Prooph\EventSourcing\AggregateChanged;
1414
use Prooph\EventSourcing\AggregateRoot;
1515
use Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator;
16+
use Prooph\EventStore\Aggregate\AggregateType;
1617

1718
/**
1819
* Class TestCase
@@ -35,6 +36,19 @@ protected function popRecordedEvent(AggregateRoot $aggregateRoot)
3536
return $this->getAggregateTranslator()->extractPendingStreamEvents($aggregateRoot);
3637
}
3738

39+
/**
40+
* @param string $aggregateRootClass
41+
* @param array $events
42+
* @return object
43+
*/
44+
protected function reconstituteAggregateFromHistory($aggregateRootClass, array $events)
45+
{
46+
return $this->getAggregateTranslator()->reconstituteAggregateFromHistory(
47+
AggregateType::fromAggregateRootClass($aggregateRootClass),
48+
$events
49+
);
50+
}
51+
3852
/**
3953
* @return AggregateTranslator
4054
*/

0 commit comments

Comments
 (0)