1 | <?php |
||
10 | trait ConstructionBehaviour |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var AggregateRootId |
||
15 | */ |
||
16 | private $aggregateRootId; |
||
17 | |||
18 | private $aggregateRootVersion = 0; |
||
19 | |||
20 | 8 | public function __construct(AggregateRootId $aggregateRootId) |
|
24 | |||
25 | 8 | public function aggregateRootId(): AggregateRootId |
|
29 | |||
30 | 8 | public function aggregateRootVersion(): int |
|
34 | |||
35 | /** |
||
36 | * @param AggregateRootId $aggregateRootId |
||
37 | * @param Generator $events |
||
38 | * |
||
39 | * @return static |
||
40 | */ |
||
41 | 8 | public static function reconstituteFromEvents(AggregateRootId $aggregateRootId, Generator $events): AggregateRoot |
|
53 | |||
54 | abstract protected function apply(Event $event); |
||
55 | } |