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