Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | public function buildProperty(TransformEvent $event): void |
||
39 | { |
||
40 | $product = $event->getObject(); |
||
41 | |||
42 | if (!$product instanceof ProductInterface) { |
||
43 | return; |
||
44 | } |
||
45 | |||
46 | $document = $event->getDocument(); |
||
47 | |||
48 | /** @var ProductVariantInterface $productVariant */ |
||
49 | foreach ($product->getVariants() as $productVariant) { |
||
50 | foreach($productVariant->getChannelPricings() as $channelPricing) { |
||
51 | $propertyName = $this->channelPricingNameResolver->resolvePropertyName($channelPricing->getChannelCode()); |
||
52 | |||
53 | $document->set($propertyName, $channelPricing->getPrice()); |
||
54 | } |
||
58 |