1 | <?php |
||
13 | trait Reconstitution |
||
14 | { |
||
15 | /** |
||
16 | * Reconstructs given concrete aggregate and applies the history |
||
17 | * |
||
18 | * @param CommittedEvents $history |
||
19 | * @return static |
||
20 | */ |
||
21 | public static function reconstituteFrom(CommittedEvents $history) |
||
28 | |||
29 | /** |
||
30 | * This trait requires a whenAll method on the concrete class |
||
31 | * |
||
32 | * @param $events |
||
33 | */ |
||
34 | abstract protected function whenAll(CommittedEvents $events); |
||
35 | |||
36 | /** |
||
37 | * This trait requires a fromIdentity method on the concrete class |
||
38 | * |
||
39 | * @param Identity $identity |
||
40 | * @return Aggregate |
||
41 | */ |
||
42 | abstract public static function fromIdentity(Identity $identity); |
||
43 | } |
||
44 |