Conditions | 3 |
Paths | 24 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | public function handle(DummyCommand $command): void |
||
39 | { |
||
40 | try { |
||
41 | if ($command instanceof InitiatorCommand) { |
||
42 | $aggregate = DummyAggregate::create($command->aggregateRootId()); |
||
43 | |||
44 | return; |
||
45 | } |
||
46 | |||
47 | /** @var DummyAggregate $aggregate */ |
||
48 | $aggregate = $this->repository->retrieve($command->aggregateRootId()); |
||
49 | /** @var string $method */ |
||
50 | $method = $this->commandToMethodMap[get_class($command)]; |
||
51 | $aggregate->{$method}(); |
||
52 | } finally { |
||
53 | if (isset($aggregate)) { |
||
54 | $this->repository->persist($aggregate); |
||
55 | } |
||
59 |