Conditions | 2 |
Paths | 2 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | public function __invoke(CreateSupplier $command): void |
||
33 | { |
||
34 | if ($this->repository->existsWithName($command->companyName()->getValue())) { |
||
35 | throw new \DomainException("Supplier with name: {$command->companyName()->getValue()} already exists."); |
||
36 | } |
||
37 | |||
38 | $supplier = $this->createSupplier($command); |
||
39 | |||
40 | $this->repository->save(SupplierEntity::fromModel($supplier)); |
||
41 | } |
||
63 |