| 1 | <?php |
||
| 8 | class DummyAggregate extends AggregateRoot |
||
| 9 | { |
||
| 10 | private $incrementedNumber = 0; |
||
| 11 | |||
| 12 | public function performDummyTask(Clock $clock) |
||
| 13 | { |
||
| 14 | $this->recordThat(new DummyTaskWasExecuted( |
||
| 15 | $this->aggregateRootId(), |
||
| 16 | $clock->pointInTime() |
||
| 17 | )); |
||
| 18 | } |
||
| 19 | |||
| 20 | public function increment(Clock $clock) |
||
| 21 | { |
||
| 22 | $this->recordThat(new DummyIncrementingHappened( |
||
| 23 | $this->aggregateRootId(), |
||
| 24 | $clock->pointInTime(), |
||
| 25 | $this->incrementedNumber + 1 |
||
| 26 | )); |
||
| 27 | } |
||
| 28 | |||
| 29 | protected function applyDummyIncrementingHappened(DummyIncrementingHappened $event) |
||
| 30 | { |
||
| 31 | $this->incrementedNumber = $event->number(); |
||
| 32 | } |
||
| 33 | |||
| 34 | protected function applyDummyTaskWasExecuted(DummyTaskWasExecuted $event) |
||
| 35 | { |
||
| 36 | |||
| 37 | } |
||
| 38 | |||
| 39 | public function dontDoAnything() |
||
| 40 | { |
||
| 41 | // not doing anything. |
||
| 42 | } |
||
| 43 | |||
| 44 | public function throwAnException() |
||
| 45 | { |
||
| 46 | throw new DummyException(); |
||
| 47 | } |
||
| 48 | } |