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