| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function validate($requestData, Constraint $constraint) |
||
| 28 | { |
||
| 29 | /** @var ProductInterface $product */ |
||
| 30 | $product = $this->productRepository->findOneBy(['id' => $requestData->getProductId()]); |
||
| 31 | $comparer = $requestData->getComparer(); |
||
| 32 | if ($comparer->hasProduct($product)) { |
||
| 33 | $this->context->buildViolation($constraint->message) |
||
| 34 | ->atPath('productExistsMessage') |
||
| 35 | ->setParameter('{{ product }}', $product->getName()) |
||
| 36 | ->addViolation(); |
||
| 37 | } |
||
| 40 |