| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 53 | public function createForProductWithId($id) |
||
| 54 | { |
||
| 55 | $product = $this->productRepository->find($id); |
||
| 56 | if (null === $product) { |
||
| 57 | throw new \InvalidArgumentException(sprintf('Product with id "%s" does not exist.', $id)); |
||
| 58 | } |
||
| 59 | |||
| 60 | $variant = $this->createNew(); |
||
| 61 | $variant->setProduct($product); |
||
| 62 | |||
| 63 | return $variant; |
||
| 64 | } |
||
| 65 | } |
||
| 66 |