| 1 | <?php |
||
| 9 | abstract class AbstractAggregateRoot |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * List of non published events. |
||
| 13 | * |
||
| 14 | * @var AbstractEvent[] |
||
| 15 | */ |
||
| 16 | private $events = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Get the unique identifier of this aggregate root. |
||
| 20 | * |
||
| 21 | * @return mixed |
||
| 22 | */ |
||
| 23 | abstract public function getId(); |
||
| 24 | |||
| 25 | public function pullEvents() |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param AbstractEvent $event |
||
| 35 | */ |
||
| 36 | protected function apply(AbstractEvent $event) |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param AbstractEvent $event |
||
| 45 | * |
||
| 46 | * @throws BadMethodCallException |
||
| 47 | */ |
||
| 48 | private function executeEvent(AbstractEvent $event) |
||
| 67 | } |
||
| 68 |