Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | public function buildProperty(TransformEvent $event): void |
||
39 | { |
||
40 | /** @var ProductInterface $product */ |
||
41 | $product = $event->getObject(); |
||
42 | |||
43 | if (!$product instanceof ProductInterface) { |
||
|
|||
44 | return; |
||
45 | } |
||
46 | |||
47 | $document = $event->getDocument(); |
||
48 | |||
49 | /** @var ProductTranslationInterface $productTranslation */ |
||
50 | foreach ($product->getTranslations() as $productTranslation) { |
||
51 | $propertyName = $this->productNameNameResolver->resolvePropertyName($productTranslation->getLocale()); |
||
52 | |||
53 | $document->set($propertyName, $productTranslation->getName()); |
||
54 | } |
||
57 |