-
Notifications
You must be signed in to change notification settings - Fork 42
/
AggregateTranslator.php
48 lines (39 loc) · 1.28 KB
/
AggregateTranslator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* This file is part of prooph/event-sourcing.
* (c) 2014-2021 Alexander Miertsch <kontakt@codeliner.ws>
* (c) 2015-2021 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Prooph\EventSourcing\Aggregate;
use Iterator;
use Prooph\Common\Messaging\Message;
interface AggregateTranslator
{
/**
* @param object $eventSourcedAggregateRoot
*/
public function extractAggregateVersion($eventSourcedAggregateRoot): int;
/**
* @param object $eventSourcedAggregateRoot
*/
public function extractAggregateId($eventSourcedAggregateRoot): string;
/**
* @return object reconstructed EventSourcedAggregateRoot
*/
public function reconstituteAggregateFromHistory(AggregateType $aggregateType, Iterator $historyEvents);
/**
* @param object $eventSourcedAggregateRoot
*
* @return Message[]
*/
public function extractPendingStreamEvents($eventSourcedAggregateRoot): array;
/**
* @param object $eventSourcedAggregateRoot
* @param Iterator $events
*/
public function replayStreamEvents($eventSourcedAggregateRoot, Iterator $events): void;
}